Question # 1: Define a class for Students with field name, age, marks. Define getter and setter for all the fields. In the setter method, if age is less than 0, print that Age is less than zero....


Note: write a java program


Question # 1:<br>Define a class for Students with field name, age, marks. Define getter and setter for all the fields.<br>In the setter method, if age is less than 0, print that Age is less than zero. Similarly, if marks is<br>less than zero or greater than 100, print in correct marks and don't assign marks to member<br>variable. In the Test class, create student's object and assign the marks and age to appropriate<br>values. Try assigning incorrect values to check if getter and setter methods work as expected.<br>

Extracted text: Question # 1: Define a class for Students with field name, age, marks. Define getter and setter for all the fields. In the setter method, if age is less than 0, print that Age is less than zero. Similarly, if marks is less than zero or greater than 100, print in correct marks and don't assign marks to member variable. In the Test class, create student's object and assign the marks and age to appropriate values. Try assigning incorrect values to check if getter and setter methods work as expected.

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here