Question
Goal: Working with Aggregate classes and Avoiding Security Issues. When writing an aggregate class, you should be careful not to unintentionally create security holes that
Goal: Working with Aggregate classes and Avoiding Security Issues. When writing an aggregate class, you should be careful not to unintentionally create "security holes" that can allow code outside the class to modify private data inside the class. In this example, the Course class is an aggregate class; it has instructor(a String) and a textbook (a Book) objects as fields. The UML Diagram for the Course class is below: + instructor: String + textbook: Book + Course(instr:String, bk:Book): 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(): + getAuthor():String + getTitle(): String + setAuthor(au:String): void + 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 accepts two parameters, a String and a Book object. Use these parameters to initialize the instance fields, instructor and textbook. (NOTE: Do not worry about writing the definiton of the Book class. It has already been defined for you. You can call the methods in the Book class specified in the UML Diagram.)
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