Question: 1. Using eclipse, create a new class) 2. You will be updating your 05CH3 program. You will develop an Algorithm and then update your java
1. Using eclipse, create a new class)
2. You will be updating your 05CH3 program. You will develop an Algorithm and then update your java Program for the problem described below: Allow the user to enter test grades until they enter a negative number. The program will: list the number of grades entered, list the number of passing grades (>= 60) total all the grades, and then display the average of the grades. For example: Enter score 1: 88.8 Enter score 2: 50 Enter score 3: 100 Enter score 4: 100 Enter score 5: -1 Total number of grades: 4 Total number of passing grades: 3 Total: 338.8 Average: 84.7 (NOTE: Follow the steps below in creating your Algorithm and Java Program. Remember, you may enter 3 grades, or 7 grades or 9 grades. Your program will keep adding the grades until it reads in a negative number)
3. The first thing you should enter in your source file is a comment block. Add a comment block at the top of the .java file (your program file), which includes the following: /* Name: Enter your full name here Lab: Chapter 5 Description: Enter the description of the program here Algorithm: Enter the Algorithm */ Page 2 of 3
4. You will be typing an Algorithm for the problem described in step 2 in the comment section of the program (see comment block in Step 3). Remember, an algorithm contains the steps necessary to solve the problem. Think of it as the outline to your program! You will be creating a simple outline before you sit down and start writing the code/program. You will be entering that outline in the comment block at the top of your program. For example, your algorithm in the comment block could start like this: a. Declare an (non-constant) integer variable for # of tests: num_tests=0 b. Declare an integer variable for # of passing grades: num_pass=0 c. Declare a double variable for an inputted test grade: inputtedTest=0 d. Declare a double variable for the running total of the grades: total=0 e. Declare a double variable for the average: average=0 f. Declare a Scanner in variable for reading input i. Scanner in = new Scanner(System.in); g. Make sure and set all the above variables to 0 to start off h. ------------------------------------------------------------ i. Create a while loop that runs until inputtedTest >= 0 a. Increment num_tests++ (itll be 1 the first time, 2 the second time, etc...) b. Prompt user to enter a test grade using System.out.println( "Enter score " + num_tests + ": "; c. Using inputtedTest = in.nextDouble(); read in the first test d. Using an if statement check to see if inputtedTest is greater than or equal to 0 and if so, increment num_pass++ and also add inputtedTest to the total, total += inputtedTest; j. Make sure num_tests does not count for the input -1 because it is not a test score before you calculate the average. a. Hint: if (inputted_Test <0) { num_tests--); k. Calculate the average and save in average and print it out using println Page 3 of 3
5. Below the comment block, type the actual Java program for the problem based on the algorithm you wrote above. Here is a snippet of my code, PLEASE do not copy as it is. Just read this to understand how to do it and work it on your own.
6. After typing your Java program, make sure to build/compile and run your program. NOTE: Feel free to be creative on the output, but make sure the answer is correct and that you include what I have at a minimum. Make sure you do not have typos in the output Make sure to run this program multiple times to ensure that it is calculating the average correctly.
7. Also create a file PDF of this Assigments.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
