Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a complete Java program so it determines a course grade using the weighted

ID: 3759622 • Letter: W

Question

Write a complete Java program so it determines a course grade using the weighted scale shown below.

Weighted Scale:

Tests 60%

Programs 40%

Prompt the user to enter the tests average and programs average. Then calculate and display the weighted average.

A sample run is shown below with the input shown in bold:

Tests: 90.0

Programs: 100.0

Grade is 94.0

Hint: Name your class Exam1 and make sure you have the main method, and import any classes needed. In the sample shown above the Grade is computed based on the following computation: 90*0.6 + 100*0.4 will result to 94.0 as the final grade. This should work for whatever values the user inputs for tests and programs.

Explanation / Answer

Solution:

package com.chegg.nancy.solution;

import java.util.Scanner;

public class Main {

   public static void main(String[] args) {
       Scanner scan = new Scanner(System.in);

       System.out.println("please enter Test : ");
       double test = scan.nextDouble();
       double program = scan.nextDouble();

       try {
           double grade = test * 0.6 + program * 0.4;
           System.out.println("Grade is " + grade);
       } catch (Exception e) {
           System.out.println("Error!");
       } finally {
           scan.close();
           System.out.println("Program Exited");
       }
   }
}

Output:

please enter
Test : 90.0
Program : 100.0

Grade is 94.0
Program Exited

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote