Question: JAVA Write a class called Student with first name, last name, gender, and age attributes and a display method. Create a two-argument, and a three-argument
JAVA
Write a class called Student with first name, last name, gender, and age attributes and a display method.
Create a two-argument, and a three-argument and a four-argument constructor.
Create instances of students using each of the constructors and invoke the display method for them.
Create a method called getAgeGroup that returns the age group of a student:
Child: if a student is younger than 12
Teenager: if a student is aged between 13 and 19
Young Adult: if a student is aged between 20 and 25
Adult: if a student is older than 25
Invoke the getAgeGroup method for those created students and display their age group along with their name and surname.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
