19.03.2023 - 18:22

In Java, Create a class named CollegeCourse that includes 4 fields ? the department name (e.g. ?ENG?), the course number (e.g. 101), the number of credits (e.g. 3) and the course fee (e.g. ?360?). Add

In Java, Create a class named CollegeCourse that includes 4 fields ? the department name (e.g. ?ENG?), the course number (e.g. 101), the number of credits (e.g. 3) and the course fee (e.g. ?360?). Add getters and setters methods for each field. Add overloaded constructor, which accepts three parameters for the proper fields above, except for the fee field ? the fee will be calculated as $120 per credit multiplied by the number of credits. Include a Display() method to display the course data. Create a subclass of CollegeCourse class named LabCourse, which adds $50 to the course fee. Override the parent class Display() method to indicate that the course is a lab course and display all the subclass data. Write an application driver UseCourse class with the main() method, which prompts a user for the course information (use Scanner class or JOptionPane). If a user enters a class in BIO or CHEM departments, create a LabClass object and enter other data to its fields. If a user enters any other department ? create an object from the base CollegeCourse class that does not include the additional lab fee. Then ? display the course data by calling the Display() method of the proper class.

Answers (1)
  • dSquared777
    April 2, 2023 в 04:46

    The CollegeCourse class in Java should have 4 fields - department name, course number, number of credits, and course fee, along with getters and setters for each field. Additionally, there should be an overloaded constructor that accepts three parameters for the department name, course number, and number of credits, and calculates the course fee as $120 per credit multiplied by the number of credits. The class should also have a Display() method to display the course data.

    To create a subclass of CollegeCourse called LabCourse, we should add $50 to the course fee and override the Display() method to indicate that the course is a lab course and display all the subclass data.

    To implement an application driver called UseCourse with the main() method, we should prompt the user for the course information using the Scanner class or JOptionPane. If the user enters a class in BIO or CHEM departments, we should create a LabCourse object and enter other data to its fields. Otherwise, we should create an object from the base CollegeCourse class that does not include the additional lab fee. Finally, we should display the course data by calling the Display() method of the proper class.

Do you know the answer?
Not sure about the answer?
Find the right answer to the question In Java, Create a class named CollegeCourse that includes 4 fields ? the department name (e.g. ?ENG?), the course number (e.g. 101), the number of credits (e.g. 3) and the course fee (e.g. ?360?). Add by subject Tech and Engineering, and if there is no answer or no one has given the right answer, then use the search and try to find the answer among similar questions.
Search for other answers
New questions in the category: Tech and Engineering
Authorization
*
*

Password generation