I have the following code: import java.util.*; import java.io.*; public class GradeBook { publicstaticvoidmain(String[] args)throwsIOException{ // TODO Auto-generated method stub File infile =newFile("students.dat"); Scanner in =newScanner(infile); while(in.hasNext()){ // Read information form file and create a student object and print String name = in.nextLine(); Student student =newStudent(name, in.nextLine()); for(int i =1; i <=4;++i){ student.setQuiz(i, in.nextInt()); } student.setMidtrmExm(in.nextInt()); student.setFinalExm(in.nextInt()); in.nextLine(); // Calculate grade and letter grade; double overallQuizScore=0.0,score=0.0; for(int i=1;i<=student.NUM_QUIZZES;i++) { overallQuizScore+=(student.getQuiz(i)/student.QUIZ_MAX_POINTS)*100; } overallQuizScore = (overallQuizScore/4)*0.30; score = overallQuizScore+(((student.getMidtrmExm()/student.MIDTRM_MAX_POINTS)*100)*0.30)+(((student.getFinalExm()/student.FINAL_MAX_POINTS)*100)*0.40); System.out.println(student); System.out.printf("Grade is: %.2f\n", score); System.out.println("Letter Grade is:"+grade(score)); System.out.println(); } } privatestaticStringgrade(double overAllScore){ String gradeLetter=""; if(overAllScore >=90) gradeLetter = "A"; elseif(overAllScore >=80) gradeLetter = "B"; elseif(overAllScore >=70) gradeLetter = "C"; elseif(overAllScore >=60) gradeLetter = "D"; else gradeLetter = "F"; return gradeLetter; } } ___________________________________________ import java.text.DecimalFormat; public class Student { private String name; private String sid; private double quizzes[]; private double exms[]; final int NUM_QUIZZES = 4; final int NUM_EXMS = 2; final int QUIZ_MAX_POINTS = 20; final int MIDTEM_MAX_POINTS = 50; final int FINAL_MAX_POINTS = 70; public Student() { this.quizzes = new double[NUM_QUIZZES]; this.exms = new double[NUM_EXMS]; } public Student(String newName) { this.name = newName; this.quizzes = new double[NUM_QUIZZES]; this.exms = new double[NUM_EXMS]; } public Student(String newName, String newSid) { this.name = newName; this.sid = newSid; this.quizzes = new double[NUM_QUIZZES]; this.exms = new double[NUM_EXMS]; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the sid */ public String getSid() { return sid; } /** * @param sid the sid to set */ public void setSid(String sid) { this.sid = sid; } public void setQuiz(int quizNumber, double score) { quizzes[quizNumber-1]=score; } public double getQuiz(int quizNumber) { return quizzes[quizNumber-1]; } public void setMidtrmExm(double score) { this.exms[0] = score; } public double getMidtrmExm() { return exms[0]; } public void setFinalExm(double score) { this.exms[1] = score; } public double getFinalExm() { return exms[1]; } /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { // DecimalFormat class is used to format the output DecimalFormat df = new DecimalFormat(".0"); double overAllScore=0.0,overallQuizScore=0.0; String str="",grade=""; str = "Student name: "+name+"\n"; str+="Student id: "+sid+"\n"; str+="Student quizzes: "; for(int i=0;i
I have the following code:
import java.text.DecimalFormat;
public class Student {
private String name;
private String sid;
private double quizzes[];
private double exms[];
final int NUM_QUIZZES = 4;
final int NUM_EXMS = 2;
final int QUIZ_MAX_POINTS = 20;
final int MIDTEM_MAX_POINTS = 50;
final int FINAL_MAX_POINTS = 70;
public Student() {
this.quizzes = new double[NUM_QUIZZES];
this.exms = new double[NUM_EXMS];
}
public Student(String newName) {
this.name = newName;
this.quizzes = new double[NUM_QUIZZES];
this.exms = new double[NUM_EXMS];
}
public Student(String newName, String newSid) {
this.name = newName;
this.sid = newSid;
this.quizzes = new double[NUM_QUIZZES];
this.exms = new double[NUM_EXMS];
}
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the sid
*/
public String getSid() {
return sid;
}
/**
* @param sid the sid to set
*/
public void setSid(String sid) {
this.sid = sid;
}
public void setQuiz(int quizNumber, double score)
{
quizzes[quizNumber-1]=score;
}
public double getQuiz(int quizNumber)
{
return quizzes[quizNumber-1];
}
public void setMidtrmExm(double score)
{
this.exms[0] = score;
}
public double getMidtrmExm()
{
return exms[0];
}
public void setFinalExm(double score)
{
this.exms[1] = score;
}
public double getFinalExm()
{
return exms[1];
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
// DecimalFormat class is used to format the output
DecimalFormat df = new DecimalFormat(".0");
double overAllScore=0.0,overallQuizScore=0.0;
String str="",grade="";
str = "Student name: "+name+"\n";
str+="Student id: "+sid+"\n";
str+="Student quizzes: ";
for(int i=0;i<NUM_QUIZZES;i++)
{
str+=df.format(quizzes[i])+" ";
}
str+="\nMidtrm exm: "+df.format(exms[0])+"\n";
str+="Final exm: "+df.format(exms[1]);
return str;
}
}
_______________________________________
I am implementing a Java class that 'simulates' a Student object.
The code for GradeBook.java and Student.java is above however it is giving me the following error:
![Failed to compile
GradeBook.java:30: error: cannot find symbol
score overallQuizScore+(((student.getMidtrmExm () /student.MIDTRM_MAX_
symbol: variable MIDTRM_MAX_POINTS
location: variable student of type Student
1 error](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe4e826cb-c133-47e8-aeaa-858e7b3a09da%2Fb82adb70-fabc-4274-9c44-449d042f2ed6%2F2fy1ti_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)