Answered step by step
Verified Expert Solution
Question
1 Approved Answer
WORK AREA Goal: Working with Aggregate classes In this example, the Course class is an aggregate class; it has instructor(a String) and a textbook (a
WORK AREA Goal: Working with Aggregate classes In this example, the Course class is an aggregate class; it has instructor(a String) and a textbook (a Book) obiects as fields. The UML Diagram for the Course class is below: + instructor: String + textbook: Book +Course(instr:String, author:String, title: String): Book Is a class that has author (a String) and title (a String) as fields. The UML Diagram for the Book class is below author:String title: String + Book): + getAuthorO:String + getTitle): String + setAuthor(au:String): vold + setTitle(ti:String): void You are given the partial definition of the Course class to modify. Define the constructor for the Course class. This constructor accept three parameters, strings for instructor, author and title. Use these parameters to initialize the instance fields, instructor and textbook g the definiton of the Book slass. It has already been defined for you. You can call the methods in the Book class specified in the UML Diagram.) SUBMIT RESET x 2 of 2: 2018-02-10 13:49:04 - W 1 class Course( 3 public Book textbook; s 11 2 public String instructor I-Insert Your Code Below 8 this.instructor-instr 9 this.textbook.setAuthor (author): 0 this.textbook.setTitle(title)j 12 4End of Your Code
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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