Suppose that a float variable called 3core contains the overall points earned fo
ID: 3624062 • Letter: S
Question
Suppose that a float variable called 3core contains the overall points earned for this course and a char variable grade contains the final grade. The following set of cascaded : f-then-else pseudocode statements determines your final grade. Your assignment is to convert this pseudocode into a Java program. Use the following template for your program and remember to maintain all the blank lines, spaces, and general alignment, and fill in the missing codes. Before submitting the program, you should test and run it, and make sure it works properly. Submit your source code (the file with the extension .java) to the HomeWork3 Folder. WARNING: NEVER WRITES YOUR SOURCE CODE USING MICROSOFT WORD! Instead, you should use either the editor come with the IDE or TextPad or notepad. Rubric for HomeWork3 This is Project has three parts, with 20 total points possible. Carefully copy the template exactly as given, maintaining all the blank lines, spaces, and general alignment. Then replace the areas that have been highlighted in yellow with your code and translate the pseudocode into a Java code. Do not change any of the other code. Compile and build the Java program. Test the program using the Test Plan as described above and make sure the program produces the desired answer.Explanation / Answer
So it is : import java.util.Scanner; /*** * File: * Author: * Date: * Class: * Instructor: * Problem: * Purpose * * */ public class ComputeGrade { public static void main(String[] args) { // Create a Scanner Scanner scanner = new Scanner(System.in); // Prompt the user to enter a float number System.out.print("Enter the final score: "); System.out.println(); float score = scanner.nextFloat(); char grade = ' '; /* Determine the final grade by turning * the above pseudocode into java code */ if (score >= 90 ) grade = 'A'; else if (score >= 75) grade = 'B'; else if (score >= 60) grade = 'C'; else if (score >= 50) grade = 'D'; else grade = 'F'; System.out.println("Your final grade is: " + grade); } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.