Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . Requirements 7 : 4 5 PM Sun Jul 2 1 CourseDemo Q Done This class stores data about an instructor. * / public
Requirements : PM Sun Jul
CourseDemo
Q
Done This class stores data about an instructor.
public class Instructor
private String firstName; First name first name, and office number. @param fname The instructor's first name. String office lastName lname; as a copy of another Instructor object. firstName objectfirstName; The set method sets a value for each field. @param fname The instructor's first name. String office lastName lname; officeNumber office; @return A string containing the instructor String str "Last Name: lastName moffice Number: t ottcenumber: private String firstName; First name first name, and office number. @param fname The instructor's first name. String office lastName lname; officeNumber office; as a copy of another Instructor object. firstName objectfirstName; The set method sets a value for each field. @param fname The instructor's first name. String office lastName lname; officeNumber office; @return A string containing the instructor String str "Last Name: lastName
Office Number: officeNumber; return str; courseName name; instr as an argument to the copy constructor. Create a new TextBook object, passingtextBook new TextBooktext; @return The name of the course.public String getName return courseName; @return A reference to a copy of this course's return new Instructorinstructor; @return A reference to a copy of this course's return new TextBooktextBook; @return A string containing the course information.public String toString Create a string representing the object.
Instructor Information:
Textbook Information:
Return the string.
private String author; Author's last name
private String publisher; Name of publisher
This constructor initializes the title,
author, and publisher fields
@param textTitle The book's title.
@param auth The author's name.
@param pub The name of the publisher.
public TextBookString textTitle, String auth,
String pub
title textTitle;
author auth;
publisher pub;
The copy constructor initializes the object
as a copy of another TextBook object.
@param object The object to copy.
public TextBookTextBook object
title objecttitle;
author objectauthor;
publisher objectpublisher;
The set method sets a value for each field.
@param textTitle The book's title.
@param auth The author's name.
@param pub The name of the publisher.
public void setString textTitle, String auth,
String pub
title textTitle;
author auth;
publisher pub;
toString method
@return A string containing the textbook
information.
public String toString
Create a string representing the object.
String str "Title: title
Author: author
Publisher: publisher;
R
In this assignment, you will modify the provided sample code that includes
Instructor.java, TextBook.java, Course.java and CourseDemo.java. The programs
work together with aggregation. The following modifications are required:
Add a field variable in Course.java to represent course number eg CSCI
so that a course object will include course number, course name, instructor, and
textbook. You may need to modify the rest of Course.java accordingly due to the
addition of course number variable marks
Add a constructor CourseCourse object to Course.java so that a course can be
constructed from another course marks
Modify CourseDemo.java to create different instructor objects, different
textbook objects and different course objects. The instructors and textbooks
must be used in defining the course objects so that each course object has a
different instructor and a different textbook. Please store instructor objects in an
instructor array, textbook objects in a textbook array, and courses in a course
array marks
Use a loop to go through the course array and print the full information of
courses. Please ensure the output is properly formatted via the toString method
marks
Please produce a screenshot to show how your program works marks
Please comment your code properly eg header comment, code comment and
follow professional programming style eg indentations, naming, etc. marks
Submission
Your code Coursejava, Instructor.java, TextBook.java, CourseDemo.java
Screenshots showing how your code works
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started