Question: EXTEND FOLLOWING CLASS Create a new class CollegeCourse that extends your Courses class. This new class should include fields for the college name and course
EXTEND FOLLOWING CLASS
Create a new class "CollegeCourse" that extends your Courses class. This new class should include fields for the college name and course number (i.e. COMP600 or ENG101, etc)
Include two constructors, two accessor methods and two mutator methods. Create a toString method that overrides the "Course" class toString method. Create an equals method that compares the teacher and course number to determine if 2 classes are the same.
import java.util.*;
class Course { String title; //title of course String teacher; //teacher of course int room; //room number int periodTime; // 0 to 24 as int form ArrayList
/* This is the client code*/ public class Main { public static void main(String[] args) { /*main method*/ Course c1 = new Course ("Math", "P White", 143, 9); Course c2 = new Course ("Science", "A Einstein", 203, 11); /*Information of each course*/ Course c3 = new Course ("Literature", "Shake Spear", 100, 11); /*This is the course's data*/ c1.addStudent (230); c2.addStudent (230); c1.addStudent (104); /*Prints information*/ System.out.println (c1); System.out.println (c2); System.out.println (c3); System.out.println (c1.hasSameTimeAs (c3)); System.out.println (c2.hasSameTimeAs (c3)); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
