Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(Edgar) immutable. Assume the 3dPoint class is immutable. Some of these functions, by their nature, make the class mutable and should be removed completely to

image text in transcribed
image text in transcribed
(Edgar) immutable. Assume the 3dPoint class is immutable. Some of these functions, by their nature, make the class mutable and should be removed completely to make it immutable. Some others might make the class mutable, but it is possible to make them safe by implementing them carefully. Others are mostly safe in an immutable class. Determine which functions should be removed, which must be carefully implemented, and which are safe. public class 3 dShape\{ private 3dPoint points; public 3dShape(3dPoint points); 1/ Sets the point array member to the given point array public void setpoints(3dPoint points); // Returns the point aray member public 3dPoint getpoints(); // Returns the volume of the shape represented by the point public double getvolume(); // Stretches the shape by the percent specified in each direction public void stretch(double x, double y, double z ); } The function setPoints to make the class immutable. The function getPoints to make the class immutable. The function getVolume to make the class immutable. The function stretch to make the class immutable. (Edgar) Select the functions from the following list that could belong to an ADT. Remember that not all ADTs are immutable. (Hint: ask yourself if these methods belong in an idealistic ADT, i.e. one truly meeting the ADT design rule.) Account ADT 1/ Accepts an int and sets the account's ipening year to that setyear(int year) Bag ADT. 1/ Sets the max capacity of the bag to the given integer setMaxCapacity(int capocity) Queve ADT. 1/ Sets the queues internal Arraylist to the given Arraylist setContents (Arraylist contents) Queue ADT 1/ renove the leost recently added item dequeue() throws ArrayoutofBoundsException

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

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

What should be the role of managers in HRD?

Answered: 1 week ago