Menu

(Solved) : Java Thanks Advance Help Post Main Class Data Files Photos Main Class Import Javautilscann Q37287177 . . .

[IN JAVA] Thanks in advance for your help! I will post the mainclass and data files below the photos.

Write a program that reads a students first name, last name, students number, month day, and year of birth and quiz gradesPerson Class Constructor -assigns fields to appropriate formal parameter:s Person -firstName: string Accessors - returns theThe main method and data file is given to you on Moodle. After the classes are working you are to write the methods called fr

Main Class:

import java.util.Scanner;
import java.io.File;
import java.io.FileNotFoundException;

public class Main
{
public static Scanner keyboard = new Scanner(System.in);
public static final int MAX_CLASS_SIZE = 100;
  
public static void main(String [] args)
{   
int num140Students;
String lastNameSearchFor;
Student [] cs140Class = new Student [MAX_CLASS_SIZE];
String fileName;
  
System.out.print(“Enter the class file name: “);
fileName = keyboard.next();
// fileName = “cs140Data.txt”; // might want to uncomment fortesting purposes
num140Students = loadArray(cs140Class, fileName);
  
System.out.println(“nPrints all students’ numbers, names, andbirthdays “);
printStudentReport(cs140Class, num140Students);
  
System.out.println(“nnPrints all students in class with theiraverage”);
printClassReport(cs140Class, num140Students);
  
System.out.println(“nnAsk user to type last name and print thestudent information and average”);
System.out.println(“If more than one with same last name it willprint them all”);
System.out.println(“If the name isn’t there, it will print – NotFound”);
System.out.print(“Enter last name: “);
lastNameSearchFor = keyboard.next();
searchAndPrintStudent(cs140Class, num140Students,lastNameSearchFor);
  
System.out.println(“nnSort by student number and print”);
sortClass(cs140Class, num140Students);
printStudentReport(cs140Class, num140Students);
  
System.out.println(“nnPrint Quiz Report”);
printQuizReport(cs140Class, num140Students);
  
}
}

Data Files:

Minnie Mouse 800222222 12 12 1998 3 75 65 85
Donald Duck 800444444 5 8 2000 6 95 75 85 88 86 94
Princess Aurora 800111111 4 7 1990 2 97 96
Daisy Duck 800999999 11 5 2001 6 75 78 74 86 85 91
Prince Charming 800888888 1 1 1981 5 75 85 71 86 95
Peter Pan 800161616 3 21 1999 10 78 74 75 85 84 95 91 93 7591
Snow White 800121212 10 29 1997 1 99
Cheshire Cat 800888888 6 14 1989 6 74 78 85 92 84 81
Captain Hook 800101010 2 15 1997 4 84 88 88 81
Roger Rabbit 800777777 7 21 2001 3 91 94 98
Buzz Lightyear 800555555 4 28 1995 3 78 85 95
Little Mermaid 800141414 8 30 1997 5 89 86 86 94 95
Mary Poppins 800666666 5 1 1982 2 87 86
Mickey Mouse 800333333 7 23 1995 5 85 100 35 65 74

Write a program that reads a student’s first name, last name, student’s number, month day, and year of birth and quiz grades from a file. The students are allowed to retake the quiz up to ten times. After the birth year, there is an integer that tells how many times the student took the quiz, and then the grades on each attempt are listed. Their grade on the quiz will be the average of the attempts For example Mickey Mouse 800001247 2 15 2000 5 95 85 72 68 59 Spaces separate the fields in the file. In this case, first name is Mickey, last name is Mouse, student number is 800001247 and his birthday is 2/15/2000. The five means that he attempted the quiz 5 times and the last five numbers are the grades he got on the attempts This assignment will use 3 classes that you are to create – Date, Person, and Student. Following the directions to create each class. Test each method as you write them. Take Note: Not all methods in all classes will be used, but all methods will be tested and graded Date Class Date Constructor – assigns fields to appropriate formal parameter – using the setters so error checking will occur -day: int -month: int -year: int +Date(month:int, day:int, year:int) Accessors – returns the appropriate field Setters setMonth – assigns the field to the formal parameter. Error checks the formal parameter to make sure it is agetMonthO: int valid month number. If it isn’t a valid month, it sets the+getDayO: int month to 1 getYear):int +setMonth(month:int):void +setYear(year:int) :void +toString0:strin setDay – assigns the field to the formal parameter. Error checks to make sure the day being passed in is a valid day* for the month the object has (ex: January can only be 1- 31). You do NOT have to check for leap year – just make sure February is 1-29. If it is invalid, it sets the day to be setYear – assigns the field to the formal parameter. Error checks the formal parameter to make sure it is not negative. If it is it sets the year to be 1900 toString – creates a string in the format M/D/Y and returns it Person Class Constructor -assigns fields to appropriate formal parameter:s Person -firstName: string Accessors – returns the appropriate field +dateOfBirth: Date Setters – assigns the field to the formal +Person(firstName:String, lastName:string, dob:Date,) parameter. (Note: for the setDateOfBirth that had 3 formal parameters, a Date objected must be created and assigned to the field +getFirstNameO: string +getLastNameO: string +getDateOfBirth0: Date +setFirstName(fname: string):void +setLastName (Iname: string) :void +setDateOfBirth(dob: Date) :void Student Class Constructor assigns fields to appropriate formal parameters +setDateOfBirth(month: int, day: int, year: int) :void Student Accessors – returns the appropriate field (note: +person: Person person is public, so no accessor is needed) -studentNum: string qizzes: int [] Setters there are no setters. The only way to assign information into an object is to create one with the constructor. quizAverage – Calculates and returns the average of the quiz grades that are in the array -numQuizAttempts: int +Student(person:Person, studentNum:string numQuizAttempts:int, quiz: int[l) getStudentNumO: string displayQuizzes – Displays the numbers in the +getNumQuizAttempts): int array to the screen. It displays them next to each other on the same line and does not put a new line at the end +quizAverage0:double +displayQuizzes(0 :void The main method and data file is given to you on Moodle. After the classes are working you are to write the methods called from the main method so that it produces the output below 2 Enter the class file name: cs140Data.txt Prints all students’ numbers, names, and birthdays Student Number Student Name 800222222 12/12/1998 Aurora, Princess Charmin 10/29/1997 Lightyear,Buzz Prints all students in class with their average Student Number Qiz Average 800222222 800121212 Ask user to type last name and print the student information and average If more than one with same last name it will print them all If the name isn’t there, it will print Not Found Enter last name: Duck 0 Sort by student number and print Student Number Student Name Aurora, Princess 10/29/1997 800222222 12/12/1998 Lightyear,Buzz Number of Attempts Quiz Grades Show transcribed image text Write a program that reads a student’s first name, last name, student’s number, month day, and year of birth and quiz grades from a file. The students are allowed to retake the quiz up to ten times. After the birth year, there is an integer that tells how many times the student took the quiz, and then the grades on each attempt are listed. Their grade on the quiz will be the average of the attempts For example Mickey Mouse 800001247 2 15 2000 5 95 85 72 68 59 Spaces separate the fields in the file. In this case, first name is Mickey, last name is Mouse, student number is 800001247 and his birthday is 2/15/2000. The five means that he attempted the quiz 5 times and the last five numbers are the grades he got on the attempts This assignment will use 3 classes that you are to create – Date, Person, and Student. Following the directions to create each class. Test each method as you write them. Take Note: Not all methods in all classes will be used, but all methods will be tested and graded Date Class Date Constructor – assigns fields to appropriate formal parameter – using the setters so error checking will occur -day: int -month: int -year: int +Date(month:int, day:int, year:int) Accessors – returns the appropriate field Setters setMonth – assigns the field to the formal parameter. Error checks the formal parameter to make sure it is agetMonthO: int valid month number. If it isn’t a valid month, it sets the+getDayO: int month to 1 getYear):int +setMonth(month:int):void +setYear(year:int) :void +toString0:strin setDay – assigns the field to the formal parameter. Error checks to make sure the day being passed in is a valid day* for the month the object has (ex: January can only be 1- 31). You do NOT have to check for leap year – just make sure February is 1-29. If it is invalid, it sets the day to be setYear – assigns the field to the formal parameter. Error checks the formal parameter to make sure it is not negative. If it is it sets the year to be 1900 toString – creates a string in the format M/D/Y and returns it
Person Class Constructor -assigns fields to appropriate formal parameter:s Person -firstName: string Accessors – returns the appropriate field +dateOfBirth: Date Setters – assigns the field to the formal +Person(firstName:String, lastName:string, dob:Date,) parameter. (Note: for the setDateOfBirth that had 3 formal parameters, a Date objected must be created and assigned to the field +getFirstNameO: string +getLastNameO: string +getDateOfBirth0: Date +setFirstName(fname: string):void +setLastName (Iname: string) :void +setDateOfBirth(dob: Date) :void Student Class Constructor assigns fields to appropriate formal parameters +setDateOfBirth(month: int, day: int, year: int) :void Student Accessors – returns the appropriate field (note: +person: Person person is public, so no accessor is needed) -studentNum: string qizzes: int [] Setters there are no setters. The only way to assign information into an object is to create one with the constructor. quizAverage – Calculates and returns the average of the quiz grades that are in the array -numQuizAttempts: int +Student(person:Person, studentNum:string numQuizAttempts:int, quiz: int[l) getStudentNumO: string displayQuizzes – Displays the numbers in the +getNumQuizAttempts): int array to the screen. It displays them next to each other on the same line and does not put a new line at the end +quizAverage0:double +displayQuizzes(0 :void
The main method and data file is given to you on Moodle. After the classes are working you are to write the methods called from the main method so that it produces the output below 2 Enter the class file name: cs140Data.txt Prints all students’ numbers, names, and birthdays Student Number Student Name 800222222 12/12/1998 Aurora, Princess Charmin 10/29/1997 Lightyear,Buzz Prints all students in class with their average Student Number Qiz Average 800222222 800121212 Ask user to type last name and print the student information and average If more than one with same last name it will print them all If the name isn’t there, it will print Not Found Enter last name: Duck 0 Sort by student number and print Student Number Student Name Aurora, Princess 10/29/1997 800222222 12/12/1998 Lightyear,Buzz Number of Attempts Quiz Grades

Expert Answer


Answer to [IN JAVA] Thanks in advance for your help! I will post the main class and data files below the photos. Main Class: impor…

OR