Question
Need help taking this average grade and having it print out the letter grade equivalent based on the average percent Then it should determine the
Need help taking this average grade and having it print out the letter grade equivalent based on the average percent
Then it should determine the letter grade for that average. I found the average but need help writing code to make that numerical value into a letter grade
The letter grade is based on the following grade range:
A: 90-100%B: 80-89%C: 70-79%D: 60-69% F: otherwise
import java.util.Scanner; import java.math.RoundingMode; import java.text.DecimalFormat;
public class a1 {
public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.print("enter first grade: "); double g1 = in.nextInt(); System.out.print("enter second grade: "); double g2 = in.nextInt(); System.out.print("enter third grade: "); double g3 = in.nextInt(); System.out.print("enter fourth grade: "); double g4 = in.nextInt(); System.out.print("enter fifth grade: "); double g5 = in.nextInt(); System.out.printf("your average grade is: %.2f",(g1+ g2+ g3+ g4+ g5)/5);
} }
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