Need a java program with these specs: Interactive input – user enters three quiz
ID: 3818575 • Letter: N
Question
Need a java program with these specs:
Interactive input – user enters three quiz scores, midterm score, and final score
Two classes – Main method in first class to get input from from user, second class (StudentRecord) to do calculations.
Calculations:
Quiz Average = Quiz 1 + Quiz 2 + Quiz 3 / 3 (there is something missing in this formula – think order of operations)
Weighted Quiz Average = Quiz Average * .25
Weighted MidTerm = MidTerm score * .35
Weighted Final = Final score * .40
Total Weighted Score = Weighted Quiz Average + Weighted MidTerm + Weighted Final
Use “If” statements to determine letter grade
A grade = > 90
B grade = > 80 and < 90
C grade => 70 and < 80
D grade => 60 and <70
F grade < 60
Other information about the grading policies: (Original Problem)
a.There are three quizzes, each graded on the basis of 10 points.
b.There is one midterm test, graded on the basis of 100 points.
c.There is one final test, graded on the basis of 100 points.
The final counts for 40% of the grade. The midterm counts for 35% of the grade.The three quizzes together count for a total of 25% of the grade. (Do not forget toconvert the quiz scores to percentages before they are averaged in.)Any grade of 90 or more is an A, any grade of 80 or more (but less than 90) is a B, anygrade of 70 or more (but less than 80) is a C, any grade of 60 or more (but less than 70)is a D, and any grade below 60 is an F. The program should read in the student’s scoresand output the student’s record, which consists of three quiz scores and two test scores, as well as the student’s overall numeric score for the entire course and finalletter grade.Define and use a class for the student record. The class should have instance variablesfor the quizzes, midterm, final, overall numeric score for the course, and final lettergrade. The overall numeric score is a number in the range 0 to 100, which representsthe weighted average of the student’s work. The class should have methods to computethe overall numeric grade and the final letter grade. These last methods should be voidmethods that set the appropriate instance variables. Your class should have areasonable set of accessor and mutator methods. You may add other methods if youwish.
See Output specs:
Enter the student's score on the first quiz: 70 Enter the student's score on the second quiz: 66 Enter the student's score on the third quiz: B2 Enter the student's score on the midterm: B0 Enter the student's score on the final: BE Student record: Quiz 1: 70, Quiz 2: 65, Quiz3: 82, Midterm: 80, Final: B5 overall numeric grade: B BUILD SUCCESSFUL (total time: 34 seconds)
Explanation / Answer
/////////////////////////////////////////////////////////////////////// Main Class ///////////////////////////////////////////////////////////////////////
import java.util.Scanner;
public class MainClass {
static int Q1score;
static int Q2score;
static int Q3score;
static int Mscore;
static int Fscore;
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
System.out.println("Enter the student's score on the first Quiz :: ");
Q1score=sc.nextInt();
System.out.println("Enter the student's score on the second Quiz :: ");
Q2score=sc.nextInt();
System.out.println("Enter the student's score on the third Quiz :: ");
Q3score=sc.nextInt();
System.out.println("Enter the student's score on the Midterm :: ");
Mscore=sc.nextInt();
System.out.println("Enter the student's score on the Final :: ");
Fscore=sc.nextInt();
StudentRecord sr= new StudentRecord(Q1score, Q2score, Q3score, Mscore, Fscore);
sr.studentGrade();
}
}
/////////////////////////////////////////////////////////////////////// StudentRecord Class ///////////////////////////////////////////////////////////////////////
public class StudentRecord {
int Q1score;
int Q2score;
int Q3score;
int Mscore;
int Fscore;
double wAvgQuiz;
double wAvgMidterm;
double wAvgFinal;
String studentGrade;
public StudentRecord(int Q1score, int Q2score, int Q3score, int Mscore, int Fscore) {
this.Q1score = Q1score;
this.Q2score = Q2score;
this.Q3score = Q3score;
this.Mscore = Mscore;
this.Fscore = Fscore;
}
double quizAverage(int Q1, int Q2, int Q3) {
return ((Q1 + Q2 + Q3) / 3) * (0.25);
}
double midtermAverage(int m) {
return m * (0.35);
}
double finalAverage(int f) {
return f * (0.40);
}
void studentGrade() {
double ta = quizAverage(Q1score, Q2score, Q3score) + midtermAverage(Mscore) + finalAverage(Fscore);
if (ta > 90) {
studentGrade = "A";
System.out.println("Student Record :: Quiz 1: " + Q1score + ", Quiz 2: " + Q2score + ", Quiz 3: " + Q3score
+ ", Midterm: " + Mscore + ", Final: " + Fscore + ". Overall numeric Grade: " + ta + ". Passing Grade :: "+studentGrade);
}
if (ta >= 80 && ta < 90) {
studentGrade = "B";
System.out.println("Student Record :: Quiz 1: " + Q1score + ", Quiz 2: " + Q2score + ", Quiz 3: " + Q3score
+ ", Midterm: " + Mscore + ", Final: " + Fscore + ". Overall numeric Grade: " + ta + ". Passing Grade :: "+studentGrade);
}
if (ta >= 70 && ta < 80) {
studentGrade = "C";
System.out.println("Student Record :: Quiz 1: " + Q1score + ", Quiz 2: " + Q2score + ", Quiz 3: " + Q3score
+ ", Midterm: " + Mscore + ", Final: " + Fscore + ". Overall numeric Grade: " + ta + ". Passing Grade :: "+studentGrade);
}
if (ta >= 60 && ta < 70) {
studentGrade = "D";
System.out.println("Student Record :: Quiz 1: " + Q1score + ", Quiz 2: " + Q2score + ", Quiz 3: " + Q3score
+ ", Midterm: " + Mscore + ", Final: " + Fscore + ". Overall numeric Grade: " + ta + ". Passing Grade :: "+studentGrade);
}
if (ta < 60) {
studentGrade="F";
System.out.println("Student Record :: Quiz 1: " + Q1score + ", Quiz 2: " + Q2score + ", Quiz 3: " + Q3score
+ ", Midterm: " + Mscore + ", Final: " + Fscore + ". Overall numeric Grade: " + ta + ". Passing Grade :: "+studentGrade);
}
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
let me know if this helps..
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.