Question
Java Programming This code has some errors, fix them and state the errors below. public class Course { public double finalGrade; // this method will
Java Programming
This code has some errors, fix them and state the errors below.
public class Course {
public double finalGrade;
// this method will calculate the average grade for the course exams, quizzes and homework
public void calculateFinalGrade() { Scanner in = new Scanner(System.in); System.out.print(\"What is the average grade for exams? \"); double examAverage = in.nextDouble(); System.out.print(\"What is the average grade for quizzes? \"); double quizzesAverage = in.nextDouble(); System.out.print(\"What is the average grade for homework? \"); double homework = in.nextDouble(); finalGrade = Math.round((examAverage * 0.5)+(quizzesAverage * 0.3)+(homework * 0.2)) // show final grade to classroom
}
public static void main(String[] args) {
System.out.println(\"*** Course 1 ***\");
// creates an instance of the course class 1 Course myCourse1 = new Course();
/ calls the calculateFinalGrade method myCourse1.calculateFinalGrade();
System.out.println(\"*** Course 2 ***\");
// creates an instance of the course class 2 Course myCourse2 = new Course();
// calls the calculateFinalGrade method myCourse2.calculateFinalGrade()
// calculate total average double totalAverage = (myCourse1.finalGrade + myCourse2.finalGrade) / 2;
// print total output System.out.printf(\"The average grade of the two courses is: .2f\", totalAverage);
//Using conditionals check if the average grade is either an A, B, C, D, or F and display it on the screen. //This is the criteria you need to use and check: //A: totalAverage >= 90. //B: totalAverage >=80 but //C: totalAverage >=70 but //D: totalAverage >=60 but //E: totalAverage
//***ENTER YOUR CODE HERE***
}
}
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