Given main(), define a Course base class with methods to set and get private fields of the following types: String to store the course number String to store the course title ● ● Define Course's PrintInfo() method that outputs the course number and title. Then, define a derived class offeredCourse with methods to set and get private fields of the following types: ● ● ● String to store the instructor's name String to store the location String to store the class time Ex. If the input is: ECE287 Digital Systems Design ECE387 Embedded Systems Design Mark Patterson Wilson Hall 231 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 Location: Wilson Hall 231 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, location, classTime;
courseNumber = scnr.nextLine();
courseTitle = scnr.nextLine();
oCourseNumber = scnr.nextLine();
oCourseTitle = scnr.nextLine();
instructorName = scnr.nextLine();
location = scnr.nextLine();
classTime = scnr.nextLine();
myCourse.setCourseNumber(courseNumber);
myCourse.setCourseTitle(courseTitle);
myCourse.printInfo();
myOfferedCourse.setCourseNumber(oCourseNumber);
myOfferedCourse.setCourseTitle(oCourseTitle);
myOfferedCourse.setInstructorName(instructorName);
myOfferedCourse.setLocation(location);
myOfferedCourse.setClassTime(classTime);
myOfferedCourse.printInfo();
System.out.println(" Instructor Name: " + myOfferedCourse.getInstructorName());
System.out.println(" Location: " + myOfferedCourse.getLocation());
System.out.println(" Class Time: " + myOfferedCourse.getClassTime());
}
}
![Given main(), define a Course base class with methods to set and get private fields of the following types:
String to store the course number
String to store the course title
Define Course's PrintInfo() method that outputs the course number and title.
Then, define a derived class offered Course with methods to set and get private fields of the following types:
String to store the instructor's name
String to store the location
String to store the class time
Ex. If the input is:
ECE287
Digital Systems Design
ECE387
Embedded Systems Design
Mark Patterson
Wilson Hall 231
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
Location: Wilson Hall 231
Class Time: WF: 2-3:30 pm](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fb0f3a834-d342-4869-9dbf-9d566abb1119%2F08468664-9fa6-4fa2-8a18-67f15ea5cbca%2Fnbp1g1m_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)