Hello once again!
I hope I'm not making a pest of myself, but I do like the way your answers/questions help me figure things out on my own and help me better understand Java. I do have a class project that has some restrictions. I have read and understand the details, and even have a plan to build the program (I'm taking Campbell's advice and building it in small pieces first, then adding to the whole.) The project description is:
This project focuses on the use of of sequential, selective and repetitive programming statements, methods, and modular programming.
1. Design and implement a Java program that will gather a group of floating point numbers and determine the sum and average of the data entered. The program should use separate methods for inputting the data, calculating the sum, calculating the average, and displaying the results. A sentinel value should be used to indicate the user has completed entering their numbers. The output should display a message that includes the count of the numbers entered, the sum of the numbers and the average of the numbers. If the sum of the numbers is greater than 100, a warning message should be displayed indicating “values have exceeded a sum 100”.
2. Additional requirements include:
1. Use JOptionPane.showInputDialog() methods for your user to input their data
2. Use JOptionPane.showMessageDialog() methods to display your messages.
I have started by asking the user to input a number using the JOptionPane.showInputDialog; checks good.
Now I am working on getting the program to count the amount of numbers entered. I felt this was a logical next step. After much trial and error, I finally got the program to output the number of times numbers were entered. The problem I am running into is that it seems that the program terminates after only one input is made. It seems like the program is skipping the while statement entirely. Below is the code:
Thank you in advance for the help! I can't wait until I'm proficient enough to pay it forward!
Kris