Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

While loops

807589Oct 25 2008 — edited Oct 27 2008
I have a quick question on While loops and what structure may be best for this particular problem that I need to address. I am unsure as to what while loop structure I should use for this particular demand.

I am to develop a solution that will calculate the average and lowest temperature for the given set of temperatures. The number of temps may differ from time to time.

To write this program I am to use a While loop. This program should read the temp from the text file named input.txt, and output the results to the text file named result.txt.

Output example:
Original set: 79 60 78 90 78
Average temp: 77
Lowest temp: 60


I am not sure what While loop should be used to to determine the average of the temps and a bit unsure how I would implement the input and output txt files for this solution. I believe I would need to use Textpad for those files.

Thanks for the guidance, I truly appreciate the help.

Ryan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 24 2008
Added on Oct 25 2008
28 comments
344 views