Gradebook program (15 points) (StudentData .java) Write the definition of the cl
ID: 3549070 • Letter: G
Question
Gradebook program (15 points)
(StudentData.java) Write the definition of the class StudentData such that an object of this class can store a student
Explanation / Answer
import java.io.*;import java.util.*;public class StudentData{private int id;private String firstName;private String lastName;private double averageScore;public StudentData() //default constructor {}public StudentData(int id, String firstName, String lastName, double averageScore){this.id = id;this.firstName = firstName;this.lastName = lastName;this.averageScore = averageScore;}public void setId( int id ){this.id = id;}public int getId(){return id;}public void setFirstName(String firstName){this.firstName = firstName;}public String getFirstName(){return firstName;}public void setLastName(String lastName){this.lastName = lastName;}public String getLastName(){return lastName;}public void setAverageScore(double averageScore){this.averageScore = averageScore;}public double getAverageScore(){return averageScore;}public char calculateGrade(){char grade;if(this.averageScore >=90){grade = 'A';}else if(this.averageScore >=80){grade = 'B';}else if(this.averageScore >= 70){grade = 'C';}else if(this.averageScore >= 60){grade = 'D';}else{grade = 'F';}return grade;}public String toString(){ return "id = " + id + "," + "name = " + name + "," + "avarege score = " + averageScore + "," + "grade is" + calculateGrade();}}//GradeBook.javaimport java.io.*;import java.util.*;public class GradeBook //client program{public static void main(String[] args) throws FileNotFoundException{//create an array of 10 elements of type StudentData???StudentData[] students = new Student[10];//create and associate the Scanner object to the input file???Scanner sc = new Scanner("student_data.txt");//create ten StudentData object to populate the array ???//read data from the file and set each object properly ???StringTokenizer st = null;for(int i=0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.