Use Java. Given main(), define a Course base class with methods to set and get the courseNumber and courseTitle. Also define a derived class OfferedCourse with methods to set and get instructorName, term, and classTime. Ex. If the input is: ECE287 Digital Systems Design ECE387 Embedded Systems Design Mark Patterson Fall 2018 WF: 2-3:30 pm the output is: Course Information: Course Number: ECE287 Course Title: Digital Systems Design Course Information: Course Number: ECE387 Course Title: Embedded Systems Design Instructor Name: Mark Patterson Term: Fall 2018 Class Time: WF: 2-3:30 pm   import java.util.Scanner; public class CourseInformation { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); Course myCourse = new Course(); OfferedCourse myOfferedCourse = new OfferedCourse(); String courseNumber, courseTitle; String oCourseNumber, oCourseTitle, instructorName, term, classTime; courseNumber = scnr.nextLine(); courseTitle = scnr.nextLine(); oCourseNumber = scnr.nextLine(); oCourseTitle = scnr.nextLine(); instructorName = scnr.nextLine(); term = scnr.nextLine(); classTime = scnr.nextLine(); myCourse.setCourseNumber(courseNumber); myCourse.setCourseTitle(courseTitle); myCourse.printInfo(); myOfferedCourse.setCourseNumber(oCourseNumber); myOfferedCourse.setCourseTitle(oCourseTitle); myOfferedCourse.setInstructorName(instructorName); myOfferedCourse.setTerm(term); myOfferedCourse.setClassTime(classTime); myOfferedCourse.printInfo(); System.out.println(" Instructor Name: " + myOfferedCourse.getInstructorName()); System.out.println(" Term: " + myOfferedCourse.getTerm()); System.out.println(" Class Time: " + myOfferedCourse.getClassTime()); } } public class Course{ // TODO: Declare private fields - courseNumber, courseTitle /*answer/* // TODO: Define mutator methods - // setCourseNumber(), setCourseTitle() /*answer/* // TODO: Define accessor methods - // getCourseNumber(), getCourseTitle() /*answer/* // TODO: Define printInfo() /*answer/* } public class OfferedCourse extends Course { // TODO: Declare private fields - instructorName, term, classTime /*answer/* // TODO: Define mutator methods - // setInstructorName(), setTerm(), setClassTime() /*answer/* // TODO: Define accessor methods - // getInstructorName(), getTerm(), getClassTime() /*answer/* }

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

8.8 LAB: Course information (derived classes)

Use Java.

Given main(), define a Course base class with methods to set and get the courseNumber and courseTitle. Also define a derived class OfferedCourse with methods to set and get instructorName, term, and classTime.

Ex. If the input is:

ECE287 Digital Systems Design ECE387 Embedded Systems Design Mark Patterson Fall 2018 WF: 2-3:30 pm

the output is:

Course Information: Course Number: ECE287 Course Title: Digital Systems Design Course Information: Course Number: ECE387 Course Title: Embedded Systems Design Instructor Name: Mark Patterson Term: Fall 2018 Class Time: WF: 2-3:30 pm
 

import java.util.Scanner;

public class CourseInformation {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);

Course myCourse = new Course();
OfferedCourse myOfferedCourse = new OfferedCourse();

String courseNumber, courseTitle;
String oCourseNumber, oCourseTitle, instructorName, term, classTime;

courseNumber = scnr.nextLine();
courseTitle = scnr.nextLine();

oCourseNumber = scnr.nextLine();
oCourseTitle = scnr.nextLine();
instructorName = scnr.nextLine();
term = scnr.nextLine();
classTime = scnr.nextLine();

myCourse.setCourseNumber(courseNumber);
myCourse.setCourseTitle(courseTitle);
myCourse.printInfo();

myOfferedCourse.setCourseNumber(oCourseNumber);
myOfferedCourse.setCourseTitle(oCourseTitle);
myOfferedCourse.setInstructorName(instructorName);
myOfferedCourse.setTerm(term);
myOfferedCourse.setClassTime(classTime);
myOfferedCourse.printInfo();

System.out.println(" Instructor Name: " + myOfferedCourse.getInstructorName());
System.out.println(" Term: " + myOfferedCourse.getTerm());
System.out.println(" Class Time: " + myOfferedCourse.getClassTime());
}
}

public class Course{
// TODO: Declare private fields - courseNumber, courseTitle

/*answer/*

// TODO: Define mutator methods -
// setCourseNumber(), setCourseTitle()

/*answer/*
// TODO: Define accessor methods -
// getCourseNumber(), getCourseTitle()

/*answer/*

// TODO: Define printInfo()
/*answer/*
}

public class OfferedCourse extends Course {
// TODO: Declare private fields - instructorName, term, classTime

/*answer/*

// TODO: Define mutator methods -
// setInstructorName(), setTerm(), setClassTime()

/*answer/*
// TODO: Define accessor methods -
// getInstructorName(), getTerm(), getClassTime()

/*answer/*

}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 1 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

This isn't showing the full Expected Output, how do you get it to print the first course details that show only number & title?

Solution
Bartleby Expert
SEE SOLUTION
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY