Answered step by step
Verified Expert Solution
Link Copied!

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 18 or above, otherwise returns false.
promote(String 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 1 to simulate a birthday.
isPassing(): a method that checks if the student's grade is passing (e.g., 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.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions

Question

LO2 Compare three types of individual incentives.

Answered: 1 week ago