Create a class named College Course that includes data field

Create a class named College Course that includes data fields that hold the department (for example, ENG), the course number (for example, 101), the credits (for example, 3), and the fee for the course (for example, $360). All of the fields are required as arguments to the constructor, except for the fee, which is calculated at $120 per credit hour. Include a display () method that displays the course data. Create a subclass named Lab Course that adds $50 to the course fee. Override the parent class display () method to indicate that the course is a lab course and to display all the data. Write an application named UseCourse that prompts the user for course information. If the user enters a class in any of the following departments, create a LabCourse: BIO, CHM, CIS, or PHY. If the user enters any other department, create a CollegeCourse that does not include the lab fee. Then display the course data. Save the files as CollegeCourse.java, LabCourse.java, and UseCourse.java.

Solution

College_Course

{

string department;

int course_number;

int credits;

int fee;

College_course(string depertment,int course_number,int credits)

{

this.depertment=department;

this.course_number=course_number;

this.credits=credits;

}

void display()

{

int fee=credits*120;

system.out.printline(\"The department is\"+department+\"cource number is\"+course_number+\"credits is\"+credits+\"fee is\"+fee);

}

}

class Lab_course extends College_Course

{

void display()

{

fee=credits*120+50;

system.out.printline(\"The department is\"+department+\"cource number is\"+course_number+\"credits is\"+credits+\"fee is\"+fee);

}

class UseCourse

{

public static void main(string[] args)

{

BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

string dep;

int course_number;

int credits;

int fee;

system.out.println(\"enter the department\");

dept=dr.readLine();

system.out.println(\"enter the course number\");

cource_number=Integer.parseInt(dr.readline();

system.out.println(\"enter credits\");

credits=Integer.parseInt(dr.readline();

system.out.println(\"enter the fee\");

fee=Integer.parseInt(dr.readline();

College_course cs=new College_course();

cs.display(dept,course_number,credits,fee);

Lab_course ls=new Lab_course();

ls.display();

}

}

thank you

Create a class named College Course that includes data fields that hold the department (for example, ENG), the course number (for example, 101), the credits (fo
Create a class named College Course that includes data fields that hold the department (for example, ENG), the course number (for example, 101), the credits (fo

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site