Question: Using Java, This Exercise has three classes: UseCourse, CollegeCourse, and LabCourse . The UseCourse class is created, you will need to create the CollegeCourse and
Using Java, This Exercise has three classes: UseCourse, CollegeCourse, and LabCourse. The UseCourse class is created, you will need to create the CollegeCourse and LabCourse class. The College Course class includes data fields that hold (1) the department(such as ENG), (2) the Course Number (for example 101), (3) the credits (for example, 3), and the fee for the course (for example $360). All but the fee field are required as arguments for the constructor. The fee field gets calculated in the constructor which is $120 per credit hour. Create a display() method with output that looks like: For the course ict362 with 3 credits your cost will be $360.00 The LabCourse class extends the College course and adds $50.00 to the course fee for lab materials. Override the display() method in the parent class so that the output looks like: The course bio141 is a lab with a $50.00 lab fee. With 3 credits your total cost will be $410.00 Pay attention to the method calls in UseCourse. Make sure these methods are included in the classes.
THE ALREADY STARTED CODE:
/* * Your Header info here!! */
import java.util.*; public class UseCourse {
public static void main(String[] args) { Scanner input = new Scanner(System.in); String labCourses = "BIO CHM CIS PHY"; System.out.println("Please enter the course department"); String department = input.next(); System.out.println("Please enter the courseNumber:"); int courseNumber = input.nextInt(); System.out.println("Please enter the number of credits:"); int credits = input.nextInt(); if(labCourses.indexOf(department.toUpperCase())>=0){ LabCourse course = new LabCourse(department,courseNumber,credits); course.display(); } else { CollegeCourse course = new CollegeCourse(department,courseNumber,credits); course.display(); } // end if
} // end main method } //end class UseCourse
class CollegeCourse { //class CollegeCourse code here }
class LabCourse extends CollegeCourse{ // class LabCourse code here }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
