https://github.com/msh-trojan/java_21_inh_3
A program using inheritance for students and Undergrad-Phd students. a good practice to see different functions we can use in each class.
https://github.com/msh-trojan/java_21_inh_3
for-loop if inheritance java super-reference
Last synced: about 1 year ago
JSON representation
A program using inheritance for students and Undergrad-Phd students. a good practice to see different functions we can use in each class.
- Host: GitHub
- URL: https://github.com/msh-trojan/java_21_inh_3
- Owner: MSH-trojan
- Created: 2024-07-08T00:52:31.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-08T12:44:25.000Z (almost 2 years ago)
- Last Synced: 2024-07-08T15:54:27.096Z (almost 2 years ago)
- Topics: for-loop, if, inheritance, java, super-reference
- Language: Java
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Java_21_Inh_3
Write a Java program using the classes Student, Undergraduate (extended from Student), and PhDStudent (extended from Student).
The constructor of Student has 2 parameters: name and a long student number,
The constructor of Undergraduate has 4 parameters: name, number, major program and year of studies.
The constructor of PhDStudent has 4 parameters: name, number, supervisor name, yearly fee.
All 3 classes have the method _toString() _
Class Undergraduate uses method_ calculateFees()_, which returns the fees to be paid by the student assuming that his/her course load is 5.0. 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.
Class PhDStudent has the method _getFee()_ to return to _main()_ the yearly fee.
Create an array of Student objects and store in it 3 Undergrad objects and 1 PhDStudent object.
Write a loop which displays the objects using the methods _toString(),_ _getFee()_ and _calculateFees()_.