Question: Write a Java program with two classes: Student and TestStudent The Student class has three properties namely ID , First, and Last, where ID is
Write a Java program with two classes: Student and TestStudent
The Student class has three properties namely ID First, and Last, where
ID is a student ID number
First is a student first name
Last is a student last name
The Student class has a constructor and a printStudent method.
The constructor accepts all three properties and set them to the object properties ID First, and
Last constructs a new student object with given fields
printStudent method returns a string representation of the invoking student object in the
format:
ID: First Name: John Last Name: Smith
The TestStudent class has the main method that
Prints a program title
Prompts the user to enter the number n of students
Creates an array named students of n students of the Student data type.
Prompts the user to enter records for all students from standard input into the
elements of the students array.
Calls the printStudent method to get string representation of the students
objects and displays them
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
