John Saito

Greenhorn
+ Follow
since Nov 08, 2005
Merit badge: grant badges
For More
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 John Saito

this is the code i have to read from the file:


I know its not complete but im clueless where to go from here.

this is the code for saving the list to a .txt.:


this outputs "OneWayNoRepeatsList@757aef" in the text file. how do i get the records that are stored in the array to save into the file.
18 years ago
the original program was a database program which keeps track of customers. Right now customer names is the only required field. the program can add, delete, search and list all records (names). There are 2 other classes that go along with this program. (sortString, OneWayNoRepeatList) all of this works just fine, what I am trying to add to the program the ability to save/read all records to a .txt file. I created 2 methods, CustomerList and saveRecords. customerList is where i want the program to read all records into the program (array) so that if a user chooses option 1, all records will be listed, including what is in the .txt file. Then if the user chooses to save, the entire list is saved to the .txt file. I dont need the option 5, which was to load the file.
18 years ago
thanks for the help so far. what i am trying to do is, to get this program to read in any names stored in a txt file (Customer List.txt) and insert them into the array. this program will allow users to add to a list, search the list for a name and delete from the list. I want to add to it buy being able to save and read from a file. It would be better if the program could read the file automatically when it is first ran. hope this clears up what i am trying to do.
18 years ago
hello, i am trying to read a list of names from a .txt file into a array when the program starts. I am completly stuck on this. this is the code is have so far but no matter what i try its not working. please help.



any help is greatly appriciated.
18 years ago
hello, i was wondering if someone could tell me what im doing wrong. i need to add a loop to my program, simply asking the user if her or she wants to continue. no matter what i try i get nothing but errors. i am trying to use "while" in this. here part of the program.
System.out.println("enter a number to convert");
iInput = Integer.parseInt(keyboard.readLine());

System.out.println("Enter units (M or K)");
cUnit = (char) System.in.read();
double dResult;
String strResult;
while ((cOption == 'Y') || (cOption == 'y')){

if ((cUnit == 'm') || (cUnit == 'M'))
{ //do math to determine Miles.
dResult = KMToMiles(iInput);
strResult = "Miles converted is ";
System.out.println(strResult + dResult);
}
else if ((cUnit == 'k') || (cUnit == 'K'))
{ //do math to determine Kilometers.
dResult = MilesToKM(iInput);
strResult = "Kilometers converted is ";
System.out.println(strResult + dResult);
}

please help.

John
18 years ago