aspose file tools*
The moose likes Beginning Java and the fly likes Java help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java help" Watch "Java help" New topic
Author

Java help

Eric Johns
Greenhorn

Joined: Sep 13, 2003
Posts: 20
I have this program that takes user input and searches a data file for cars that meet the users preferences, now if their are cars that match. The output, "Cars that match your requirements with at least 80% fit:, needs to display how many cars that would be and I can't seem to figure out how I could go about doing this. below I have what I have come up with I have added another if statement and another var called totalcars. is their a way to take the cars that work for the boolean statement and register them into a number?
thanks Eric



(Marilyn added code tags)
[ September 27, 2003: Message edited by: Marilyn de Queiroz ]
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
If I'm reading this right, this might work
Eric Johns
Greenhorn

Joined: Sep 13, 2003
Posts: 20
yeah I think that would work, but the counter has to been in the statment "Cars that match your requirements with at least 80% fit", so it should say something like Example, "2 Cars that match your requirements with at least 80% fit:" and the problem I'm having is that statement can only be displayed once per starting run of the loop and since the guts of the calculations are in a for loop how can I get a total number of cars that are going to get printed when the loop running on car at a time.
I can't seem to think of anything
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
This should do what you want (this is aircode - so expect typos, missing semi-colons etc). You might also have to convert some of the carData info to String.

[ September 28, 2003: Message edited by: Michael Dunn ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java help