Answer to Question #168258 in Java | JSP | JSF for Bwalya

Question #168258

Write a Java program that determines a student’s grade.

The program will read three types of scores(quiz, mid-term, and final scores) and determine the grade based on the following rules:

-if the average score >=90% =>grade=A

-if the average score >= 70% and <90% => grade=B

-if the average score>=50% and <70% =>grade=C

-if the average score<50% =>grade=F


1
Expert's answer
2021-03-02T13:36:45-0500
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Enter the quiz score:");
        double average = 0;
        average += in.nextDouble();
        System.out.println("Enter the mid-term score:");
        average += in.nextDouble();
        System.out.println("Enter the final score:");
        average += in.nextDouble();
        average /= 3;
        if (average >= 90) {
            System.out.println("Grade A");
        } else if (average >= 70) {
            System.out.println("Grade B");
        } else if (average >= 50) {
            System.out.println("Grade C");
        } else {
            System.out.println("Grade F");
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog