GradeCalculation.java /* Programmer: Date: Project: Lab 2.2 GradeCalculation Fil
ID: 3751524 • Letter: G
Question
GradeCalculation.java/* Programmer: Date: Project: Lab 2.2 GradeCalculation File Name: GradeCalculation.java Program Description: Determine someone's grade. */ import java.util.*;
public class GradeCalculation { public static void main( String[] args ){
// Variable to accept the user's input Scanner keyboard = new Scanner(System.in);
// Enter your code here
} } /* Programmer: Date: Project: Lab 2.2 GradeCalculation File Name: GradeCalculation.java Program Description: Determine someone's grade. */ import java.util.*;
public class GradeCalculation { public static void main( String[] args ){
// Variable to accept the user's input Scanner keyboard = new Scanner(System.in);
// Enter your code here
} } For Intro to Computer Science, tests account for 50% of your grade, labs account for 30% of your grade, homework accounts for 10% of your grade, and quizzes account for the remaining 10% of your grade Write a program that asks the user their test, lab, homework, and quiz percentages, calculates their final grade for the class, and then tells them their letter grade Use the grading scale below from OLHS Grade Percenta x292.5 89.5Sx
Explanation / Answer
Java:
/* Programmer:
Date:
Project: Lab 2.2 GradeCalculation
File Name: GradeCalculation.java
Program Description: Determine someone's grade.
*/
import java.util.*;
public class GradeCalculation {
public static void main( String[] args ){
// Variable to accept the user's input
Scanner keyboard = new Scanner(System.in);
// Enter your code here
// Taking input
float test,lab,hw,quiz;
System.out.print("Input test%: ");
test=keyboard.nextFloat();
System.out.print("Input lab%: ");
lab=keyboard.nextFloat();
System.out.print("Input HW%: ");
hw=keyboard.nextFloat();
System.out.print("Input quiz%: ");
quiz=keyboard.nextFloat();
// Calculating final grades
double grade=(test/2)+(3*lab/10)+(hw/10)+(quiz/10);
String s;
// Checking which grade student is getting.
if(grade>=92.5)
s="A";
else if(grade>=89.5 && grade<92.5)
s="A-";
else if(grade>=86.5 && grade<89.5)
s="B+";
else if(grade>=82.5 && grade<86.5)
s="B";
else if(grade>=79.5 && grade<82.5)
s="B-";
else if(grade>=76.5 && grade<79.5)
s="C+";
else if(grade>=72.5 && grade<76.5)
s="C";
else if(grade>=69.5 && grade<72.5)
s="C-";
else if(grade>=66.5 && grade<69.5)
s="D+";
else if(grade>=62.5 && grade<69.5)
s="D";
else if(grade>=59.5 && grade<62.5)
s="D-";
else
s="F";
// Printing the output.
System.out.println("Your final percentage is "+grade+"%,meaning you have a "+s+".");
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.