Question
Use Eclipse IDE to create a new class 2. You will be designing an algorithm and developing a Java program for the problem described below:
Use Eclipse IDE to create a new class
2. You will be designing an algorithm and developing a Java program for the problem described below: Have the user input three test grades and then display the tests in increasing order, followed by the average. For example: Enter score 1: 88.8 Enter score 2: 50 Enter score 3: 100 The average of 50, 88.8 and 100 is: 79.6
3. 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 4). 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. This an important part of learning programming, For example, your algorithm in the comment block could start like this: (THIS IS JUST AN EXAMPLE. Doing it on your own will help you learn better) a. Declare an integer constant for number of tests: NUM_TESTS = 3 b. Declare three double variables for test scores: test1, test2, test3 c. Declare three double variables for test scores: low, mid, high d. Declare a double variable to calculate the test average: averageTestScore e. Prompt user to enter test1 as shown above i. System.out.println(""); ii. System.out.print("Enter Score1:"); f. Using Scanner class read in the input test 1 score i. Scanner in = new Scanner(System.in); ii. test1 = in.nextDouble(); g. Prompt user to enter test2 as shown above in #e i. System.out.println(""); ii. System.out.print("Enter Score2:"); h. Read in the second test score i. test2 = in.nextDouble(); i. Prompt user to enter test3 as shown above in #e i. System.out.println(""); ii. System.out.print("Enter Score2:"); j. Read in the third test score i. test3 = in.nextDouble(); k. Using an if statement to check to see: Page 2 of 2 i. if (test1 < test2 && test1 < test3 && test2 < test3) and if so, set low = test1; mid = test2; high = test3; l. else if (test1 < test2 && test1 < test3 && test3 < test2) and if so, set i. low = test1; mid = test3; high = test2; m. else if (test2 < test1 && test2 < test3 && test1 < test3) and if so, set i. low = test2; mid = test1; high = test3; n. Write three more if statements to handle the other cases (there are 6 possible cases) o. Calculate the average and save in averageTestScore p. Print out the output as shown above in Step 2
4. 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 3 Description: Enter the description of the program here Algorithm: Enter the Algorithm, discussed in step
5 below */ 5. Below the comment block, type the actual java program for the problem described in step 2 based on the algorithm you wrote in step 3.
6. After typing your java program, make sure to build/compile and run your program so that you obtain the result (The average of 50, 88.8 and 100 is: 79.6) on the console window. NOTE: Feel free to be creative on the output, but make sure the answer is correct Make sure you do not have typos in the output
7. You may upload your java file.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started