Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions 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
Check Mark
Still need help?
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
by Bartleby Expert
SEE SOLUTION
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
by Bartleby Expert
SEE SOLUTION
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY