In: Computer Science
Write a Java program that outputs the output below
Student Name: Andrew Johnson
Course: Biology 101
Quiz Average and percent weight (separated by a space):
87 15
Project Average and percent weight (separated by a space):
92 25
Exam Average and percent weight(separated by a space): 85
40
Final Exam and percent weight (separated by a space):
83 20
Final Grade in Biology 101 for Andrew Johnson is 86.7
The largest average was 92
The smallest average was 83
Thank you for using my grade program!!
import java.util.Scanner; public class GradeProgram { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("Student Name: "); String name = in.nextLine(); System.out.print("Course: "); String course = in.nextLine(); System.out.print("Quiz Average and percent weight (separated by a space): "); int quiz = in.nextInt(); int quizPercentage = in.nextInt(); System.out.print("Project Average and percent weight (separated by a space): "); int project = in.nextInt(); int projectPercentage = in.nextInt(); System.out.print("Exam Average and percent weight (separated by a space): "); int exam = in.nextInt(); int examPercentage = in.nextInt(); System.out.print("Final Exam and percent weight (separated by a space): "); int finalExam = in.nextInt(); int finalExamPercentage = in.nextInt(); double total = ((quiz*quizPercentage)+(project*projectPercentage)+(exam*examPercentage)+(finalExam*finalExamPercentage))/100.0; System.out.println("Final Grade in " + course + " for " + name + " is " + total); System.out.println("The largest average was " + Math.max(Math.max(quiz, project), Math.max(exam, finalExam))); System.out.println("The smallest average was " + Math.min(Math.min(quiz, project), Math.min(exam, finalExam))); System.out.println("Thank you for using my grade program!!"); } }