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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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<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
Transcribed Image Text: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
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education