Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

AggregationClass In order to gain practical knowledge of aggregation and to practice deep copying of field objects we will implement a class called Aggregation. Start

AggregationClass
In order to gain practical knowledge of aggregation and to practice deep copying of field objects we will implement a class called Aggregation.
Start your work with Aggregation.java class provided. There you will see all fields already set up. There are also 2 methods written in: toString() and forDeepCopyTesting(). Do not make any changes to them.
The class has 3 fields:
fractionField of type Fraction (class from the first problem)
arrayField array of Rectangles. Custom Rectangle class is provided among the assignment files.
doubleField of type double
The class does not really have any functionality and its main purpose is to give you a hands-on review of the aggregation concept. Class has a very limited number of methods, all of them are standard methods that you would expect to see in any regular class.
Non-argument constructor that sets
fractionField to fraction 0/1,
arrayField to an array of size 1 filled with Rectangle with both width and length set to 1
doubleField to 0.0
Constructor that takes a fraction, an array, and a double as parameters and sets all 3 fields to the given values. Make sure to create DEEP COPIES of all non-primitive parameters when setting the new object fields.
Copy constructor. Make sure to create DEEP COPIES of all non-primitive fields when setting the new object fields.
Three accessor methods for all 3 fields. Make sure to create DEEP COPIES of all non-primitive fields and return a reference to a copy not to the original field.
Three mutator methods for all 3 fields. Make sure to create DEEP COPIES of all non-primitive parameters when changing the value of the fields.
AggregationClass methods and their point values
Test Group #
Methods Tested
Point Value
1
No-argument constructor; Constructor
10
2
3 accessors; 3 mutators
10
3
Copy constructor
10
Total
30

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_2

Step: 3

blur-text-image_3

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

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions

Question

Give three examples of social engineering not listed in the text.

Answered: 1 week ago

Question

1. Identify six different types of history.

Answered: 1 week ago

Question

2. Define the grand narrative.

Answered: 1 week ago

Question

4. Describe the role of narratives in constructing history.

Answered: 1 week ago