Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started