Question
1. Create an abstract class named Course. Each course object will have attributes for course ID, course title, enrollment limit, and price each student pay
1. Create an abstract class named Course. Each course object will have attributes for course ID, course title, enrollment limit, and price each student pay when taking the course.
2. Each course will be taught by a single Faculty member so the course will have information about the professor who teaches the course. This information include faculty ID and faculty name. Implement the appropriate relationship between the Faculty and Course classes.
3. Add an abstract parameterless method named calculate Revenue to Course.
4. Create a concrete class named Programming Course that extends Course. Have an additional attribute in this class to indicate the programming language used.
5. In Programming Course, implement calculate Revenue. For simplicity, this method will compute the revenue generated from the course by assuming the course always reaches the enrollment limit.
6. Create a class named Use Course. In this class, declare a global arraylist that can store course objects.
7. In the main method, create two programming courses and add them to the array list. (You don’t have to ask the user to enter the data for the courses, just use any values of your choice).
8. Display the revenue generated by each course.
9. Object Serialization: Since arrays are objects in Java, entire arrays of Serializable objects can be saved in a file simply by passing the array name to an Object Output Stream’s write Object method. Write code that will create a file named Courses Data. ser for object output and saves the entire array in that file. When the program runs later, your code will read the array back from the file. Hint: remember that your classes must implement the Serializable interface
Step by Step Solution
3.39 Rating (155 Votes )
There are 3 Steps involved in it
Step: 1
Faculty Java Contains Faculty Class package myPackage import javaioSerializable public class Faculty implements Serializable private static final long serialVersionUID 1L required for serialization pr...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started