Question: Build a Java class na age ( int ) : representing the age of the student. Constructors: A default constructor that constructor that accepts values
Build a Java class na
age int: representing the age of the student.
Constructors:
A default constructor that constructor that accepts values for all data fields and initializes them accordingly.
Methods:
isAdult: a method that returns true if the student's age is or above, otherwise returns false.
promoteString newGrade: a method that updates the grade of the student to the provided newGrade.
getGrade: a method that returns the current grade of the student. provided newGrade.
birthday: a method that increments the age of the student by to simulate a birthday.
isPassing: a method that checks if the student's grade is passing eg grade is not F and returns true if passing, otherwise returns false.
Additionally, create another class named StudentDemo with a main method to demonstrate the functionality of the Student class. In the main method, create instances of the Student class using both constructors, call each method of the Student class to demonstrate their functionality, and print the results.
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
