Answered step by step
Verified Expert Solution
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 methods written in: toString and forDeepCopyTesting Do not make any changes to them.
The class has 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 handson 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.
Nonargument constructor that sets
fractionField to fraction
arrayField to an array of size filled with Rectangle with both width and length set to
doubleField to
Constructor that takes a fraction, an array, and a double as parameters and sets all fields to the given values. Make sure to create DEEP COPIES of all nonprimitive parameters when setting the new object fields.
Copy constructor. Make sure to create DEEP COPIES of all nonprimitive fields when setting the new object fields.
Three accessor methods for all fields. Make sure to create DEEP COPIES of all nonprimitive fields and return a reference to a copy not to the original field.
Three mutator methods for all fields. Make sure to create DEEP COPIES of all nonprimitive parameters when changing the value of the fields.
AggregationClass methods and their point values
Test Group #
Methods Tested
Point Value
Noargument constructor; Constructor
accessors; mutators
Copy constructor
Total
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