0% found this document useful (0 votes)
18 views1 page

Hi 2

The document describes a class structure for a Student system, including a base class 'Student' with instance variables and methods, and two subclasses 'DayScholar' and 'Hosteller' with additional properties and methods. Each class includes constructors and methods for displaying details and processing fee payments, calculating remaining amounts based on total fees. A 'StudentTester' class is provided for testing the functionality of these classes.

Uploaded by

MONICA NAHAK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views1 page

Hi 2

The document describes a class structure for a Student system, including a base class 'Student' with instance variables and methods, and two subclasses 'DayScholar' and 'Hosteller' with additional properties and methods. Each class includes constructors and methods for displaying details and processing fee payments, calculating remaining amounts based on total fees. A 'StudentTester' class is provided for testing the functionality of these classes.

Uploaded by

MONICA NAHAK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

A class Student is given to you. It contains the following implementation.

Instance Variables: studentId : int , name :String , examFee:double


Methods: displayDetails(): String , payFee() :double
Default constructor, an all-fields constructor and a toString method.
Create two sub classes of Student called DayScholar and Hosteller. Add the following
implementations to each class.
DayScholar:
Instance Variables : transportFee:double ,
Methods: Default constructor and an all-fields constructor
Hosteller:
Instance Variables: hostelFee :double
Methods: Default constructor and an all-fields constructor .
Add the following methods in BOTH classes.
Method: displayDetails(): This method should return a string containing the details of the
student in the following format:
Student [name=John Smith,studentId=123,examFee=100.0] OR
DayScholar[transportFee=500, name=John Smith,studentId=123,examFee=100.0] and so on.
Method: payFee(amount): This method takes amount as parameter that represents the fee
provided. You must calculate and
then return the remaining amount paid in excess. If excess is paid, the returned amount will be
negative. The total fees that each student must pay must include all the fees applicable to that
Student(examFees, transportFees, hostelFees as applicable). Subtract the given amount from
total fee for each student and return the remaining amount.
A class StudentTester is given to you with a main method. Use this class to test your solution's
classes and methods.

You might also like