prerna boja

Ranch Hand
+ Follow
since Aug 19, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by prerna boja

Hi all,

I have a program to display the array data n find the largest n smallest values.

I am getting an exception in the main program as java.lang.NumberFormatException :For input String :"2 3 4".

Please tell me where I am wrong. I feel my getTable method is the problem.
Please help me out it is really tough I always get stuck at using indexOf n substring.

debug.dat :
4 4
1 2 3 4
5 6 7 8
9 8 7 6
1 3 3 5





17 years ago
I corrected few of my mistakes.

Like :1)when read in file, I should not have a semicolon after the (loop test); (corrected as while(right >= left && !found) )

2) My invArray declaration.(corrected as rivate static Inventory invArray[] = new Inventory[7]; ) as Invenotry.txt is :
1178,4.52,10
1295,1.75,30
1299,14.82,20
1384,9.82,50
1471,2.50,100
1502,3.82,60
1532,9.87,15


3) Binary search :


4)acctually I did not drop the curly bracelet in the correct position, make the while loop not work,then data can not be read in.



I corrected all the above but still my program is not working.

Can anybody please check my Binary serach n point 4,Whether they are correct or not.Please let me know where in the program I am wrong.

Please help me out.
17 years ago
yes that is what I want to do.

17 years ago
Hey ,

I tried it out. There is nothing worng in that code. I am held up at if(found) loop. I am getting confused ,the more I try to rectify the code.
17 years ago
I think it is correct. What is wrong with the code I have to scheck whether the stringline is null or not.
17 years ago
Hi all,


I rectified my problem, But still I am not able to get the price n quantity on hand to the textfield. I get only status as "Item not found".i.e only else loop is executing.
but my if(found) loop is not exectuting.Why is it so?

Help me out.


17 years ago
I did not get it. Can anybody plzzzzzzzzzzz expalin where I am wrong.
Thanks
17 years ago
Hi all,

I have to build an interactive program that reads in the information about the Inventory objects from the file Inventory.txt into an array of Inventory objects.

I complied my Inventory.java program,it is working fine. I am not able to read the data from Inventory.txt to the FinalExam class.

For example if I type the product code as 1178,and press lookup button then the price(prints 4.52), QuantityOnHand(prints 10) and status(found) should be dispalyed on the frame.

Help me out. I am trying this out from 2 days.

My Inventory.txt :
1178,4.52,10
1295,1.75,30
1299,14.82,20
1384,9.82,50
1471,2.50,100
1502,3.82,60
1532,9.87,15

17 years ago
Hi,

It is terminating once I cast it .But after many lines.
I tried to place '\n' in while loop like
----------------------------------
while(symbol != '\n')
---------------------------------------
I get the same problem, the loop is not terminating. The loop should terminate once the it checks all new lines n there are no more semicolons.

---------------------------------------------------------------------------
My shell1.dat file contains :

There are lots of symbols in this file: ..;;??
.,.,.,?::: .

---------------------------------------------------------------------------
17 years ago
Hi all,

I am getting the output correctly for this program, but I am not able to terminate the loop. It keepssssss printimgg. How can I terminate the loop?

17 years ago
Hi all,

I need to the chage this program. The Switches class uses a combination of an IF satatement and a SWITCH.I need to rewrite the buttin handler to use just a SWITCH statement.



I tried to change the programe using an another case in switch statement as :
Case 'Q' : case 'q' utWindow.dispose();
System.exit(0);

It did not work, it worked only when I passed the integers .But This is worng. Once I type "Q or q" in the textfield and press enter, the window should be closed.It is not happening so.

Please give me an idead ,how to change the program.
Thanks in advance.
17 years ago
Hi ,

I tried to chage the program. It is compiling n giving no exception, but I amnot getting the output.

17 years ago
Hi all,

I wrote the following program. I need to get the number of odd n even numbers from "data.in" file .

I am getting an exception as :Exception in thread "main" java.lang.StringIndexoutofBoundsException : index out of range:-1
at java.lang.String.substring<String.java:1768>
at oddeven.main<oddeven.java:23>


data.in file contains :The first data value is
1066
The second data value is
1492
The third data value is
1939
The fourth data value is
1944
The fifth data value is
2000

help me out
17 years ago
Hi all,


I have the following program. I have to get the number of question marks,semicolons.... in the ouput. I am getting the output wrong. Please help me....




Shell1.dat : There are lots of symbols in this file: ..;;??
.,.,.,?::: .


I have to get only 3 question marks but I am getting the ouput as 63.
17 years ago
I did the inFile.readLine() before the parsing the float.

inputString = inFile.readLine();
value = Float.valueOf(inputString).floatValue();
17 years ago