Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Download: http://solutionzip.com/downloads/prj2-lastnamefirstinitial/
- 1. Create a Java Application Project named PRJ2[Last Name][First Initial]. As an example, if your name was Xavier Smith, then the project would be named PRJ2SmithX.
- 2. Review the requirements for the program (3 a. – 3 f.) then generate a test plan in a document named PRJ2SmithXTestPlan using the Test Plan Example document listed in Week 1 Activities as a guide.
- 3. Once you are in the IDE with the tabbed PRJ2SmithX.java in the Source window, begin developing the following program:
- a. Declare all necessary identifiers.
- b. Inside a while loop:
- 1. Accept decimal numbers using a Dialog Input Box (JOptionPane.showInputDialog()).
- 2. Verify that the correct number was entered. [It is assumed that the values will be greater than zero.]
- 3. Sum the decimal numbers as each is entered.
- 4. When the sum of the entered decimal numbers is above a total of 100 for the first time – and only the first time:
- • Display a message with a Message Dialog Box (JOptionPane.showMessageDialog()) informing the user that the total number is ***** 100.
- • In addition to the warning also display in the Message Dialog Box the actual total sum at that point.
- • Do not show this message again for any additional entries above 100.
- 5. Keep a counter for the number of times a new decimal number is *****
- 6. Have a prompt asking the user when to end entering decimal numbers.
- 7. Use a sentinel to end the loop in combination with a prompt. [Review the usage of “while true { }” with a break command.]
- c. After the loop, call a calculation method that will return the average from the sum and counter. [An example of the construction of a method/function with its “calling code” is listed at the end of the assignment.]
- d. Call another method that will display the results of the processing in the program. This display has three lines in a single Message Dialog Box containing
- • The total number of entries
- • The sum of all the entries
- • The average of the number of entries
- Hint: A new line is displayed after each \n in the println in the Message Dialog Box.
- e. When the user ends the program include a final line of text after a blank line, adding an appropriate ending message.
- f. Add the appropriate documentation to the program as suggested in the Documentation for Programs document listed in Week 1 Activities as a guide.
- Download: http://solutionzip.com/downloads/prj2-lastnamefirstinitial/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement