Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*Java Language Aggregation* Instructions: Make a code Using Aggregation Following the Example below With the course, as the super class, Instructor and Textbook as the

*Java Language Aggregation*

Instructions: Make a code Using Aggregation Following the Example below With the course, as the super class, Instructor and Textbook as the sub class. Make a code that showsVehicle as super class. and motercycle and bus as sub classes. attributes to get for car is company of car,model for car,color of car. The super class vehicle should say vehicle. Have Aggregated UML as well for all 3 classes. Need to have at least one method in every code and UML. **Read What textbook says**

I Will Thumbs Up

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribed

image text in transcribed

8.7 Aggregation CONCEPT: Aggregation occurs when an instance of a class is a field in another class. In real life, objects are frequently made of other objects. A house, for example, is made of door objects, window objects, wall objects, and much more. It is the combination of all these objects that makes a house object When designing software, it sometimes makes sense to create an object from other objects For example, suppose you need an object to represent a course that you are taking in college. You decide to create a Course class, which will hold the following information: VideoNote Aggregation .The course name .The instructor's last name, first name, and office number The textbook's title, author, and publisher In addition to the course name, the class will hold items related to the instructor and the textbook. You could put fields for each of these items in the Course class. However, a good design principle is to separate related items into their own classes. In this example, an Instructor class could be created to hold the instructor-related data and a TextBook class could be created to hold the textbook-related data. Instances of these classes could then be used as fields in the Course class. Let's take a closer look at how this might be done. Figure 8-11 shows a UML diagram for the Instructor class. To keep things simple, the class has only the following methods: A constructor, which accepts arguments for the instructor's last name, first name, and office number A copy constructor . A set method, which can be used to set all of the class's fields A toString method Figure 8-11 UML diagram for the Instructor class Instructor - lastName : String -firstName String - officeNumber String + Instructor(Iname: String, fname: String office String) + Instructor(object2 : Instructor) + set (Iname : String, fname : String office : String): void + toString) : String

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Flash XML Applications Use AS2 And AS3 To Create Photo Galleries Menus And Databases

Authors: Joachim Schnier

1st Edition

0240809173, 978-0240809175

More Books

Students also viewed these Databases questions

Question

10. Are you a. a leader? b. a follower? _______

Answered: 1 week ago

Question

What did they do? What did they say?

Answered: 1 week ago