https://github.com/msh-trojan/java_21_inh_2
A program demonstrating a student with their name, ID number, year of study, major , and fees based on their courseload with the consideration of the year of their study.
https://github.com/msh-trojan/java_21_inh_2
inheritance java overriding overriding-methods super-reference
Last synced: about 1 year ago
JSON representation
A program demonstrating a student with their name, ID number, year of study, major , and fees based on their courseload with the consideration of the year of their study.
- Host: GitHub
- URL: https://github.com/msh-trojan/java_21_inh_2
- Owner: MSH-trojan
- Created: 2024-07-07T22:51:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-07T23:13:18.000Z (almost 2 years ago)
- Last Synced: 2024-07-08T00:24:52.442Z (almost 2 years ago)
- Topics: inheritance, java, overriding, overriding-methods, super-reference
- Language: Java
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Java_21_Inh_2
Write a Java program using the classes Student and Undergraduate (extended from Student).
The constructor of Student has 2 parameters: _name and a long student number_,
while the constructor of Undergraduate has 4 parameters: _name, number, major program and year_ of studies.
Both classes have the method _toString()_ and the method: _public double calculateFees(double courseload)_, which returns the fees to be paid by the student depending on his/her course load.
Suppose that for students generally, the fees are $800/course, and that for undergraduates, there is an additional incidental charge of $100 for first year students and $150 for students in later years.
Create a Student object with the name “Mary" and the number 202345678 and an Undergraduate object with the name “John”, the number 201234567, the ITEC program and in the 1st year.
For each object display the String produced by the _toString()_ method and the double produced by the _calculateFees()_ method for 4.5 course load.
Finally use a reference of Student type to point to the Undergraduate object and use that reference to display the Undergraduate object.