(Solved) : Input Student Data File Create Student Object Write Student Object Data Standard Output Do Q30456378 . . .
input student data from a file
create a student object
write the student object data to standard output.
Download the input text file studentInput.txt. This filecontains four lines with a student’s data. The first line is thestudent’s first and last name, the second line is the student’s idnumber, the third is the student’s year and the fourth containingthe student’s major.
Create a java file called<yourLastName>Student.java. Thisfile will contain the Student class. My program would beConwayStudent.java and my class name would be ConwayStudent.
In the class Student, code the following methods and data:
Fields (all should be private):
– String name
– int idNumber
– char year
– String major
Methods (all should be public):
– No argument constructor
– Constructor with 4 parameters: name, idNumber, year, major
– Accessors and mutators for fields
– a display method that nicely displays the values in thestudent object: name, id number, year and major
Modify your RunStudent program from project 1 to read a set ofdata from an input file and create a Student object. Instead ofasking the user for the student data, the program will open theinput file for reading (hard code the name of the input file –studentInput.txt) and read the four lines of data from the file.Make sure to remove the prompts to the user. You can use the Fileand Scanner classes to read from the file and you can assume thefile exists.
Store the inputted values in appropriate variables. As in theprevious project, store the name and major as Strings, the idnumber as an int, and the year as a char (F/O/J/S where F is forfreshman, O is for sophomore, J is for junior, S is forsenior).
Use the values obtained from the input file to create a studentobject. Finally, use the student object to call the display method.The only output should be a formatted display of the four values inthe student object.
—————————————————
studentinput.txt ->
Rascal Conway12345FVeterinary science
Expert Answer
Answer to Input Student Data File Create Student Object Write Student Object Data Standard Output Do Q30456378 . . .
OR