Kojo K.

asked • 06/22/20

Any help please.

Define a Rectangle class that provides getLength and getWidth. Using

the findMax routines in implementation, write a main that creates an array

of Rectangle and finds the largest Rectangle first on the basis of area

and then on the basis of perimeter.



This is the implementation

/**

* A class for simulating an integer memory cell.

*/

class IntCell

{

public:

/**

* Construct the IntCell.

* Initial value is 0.

*/

IntCell( )

{ storedValue = 0; }


/**

* Construct the IntCell.

* Initial value is initialValue.

*/

IntCell( int initialValue )

{ storedValue = initialValue; }


/**

* Return the stored value.

*/

int read( )

{ return storedValue; }


/**

* Change the stored value to x.

*/

void write( int x )

{ storedValue = x; }


private:

int storedValue;

};


2 Answers By Expert Tutors

By:

Patrick B. answered • 06/23/20

Tutor
4.7 (31)

Math and computer tutor/teacher

Kojo K.

Thanks a lot. I wish it was in C++. Not so familiar with java.
Report

06/23/20

Jeffrey Z. answered • 06/23/20

Tutor
4.8 (18)

UPenn Grad Experienced in tutoring Finance, Computer Science, and Math

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.