Question: This is to be written in Java code. Please follow the instruction and make sure the program has all the components of the rubric. Do

This is to be written in Java code.

Please follow the instruction and make sure the program has all the components of the rubric.

Do not worry about the PMR in the Rubric.

This is to be written in Java code. Please follow the instructionand make sure the program has all the components of the rubric.Rubric

Do not worry about the PMR in the Rubric. Rubric Box.Java public

Box.Java

public class Box3 extends Rectangle3 { // instance variables private int height;

// Constructor for objects of class Box public Box3(int l, int w, int h) { // call superclass super(l, w);

// initialize instance variables height = h; }

// return the height public int getHeight() { return height; }

// String to display when object is printed. /* public String toString() { return "The box's dimensions are " + getLength() + " X " + getWidth() + " X " + height; } */ }

Rectange.Java

public class Rectangle3 { // instance variables private int length; private int width;

// Constructor for objects of class Rectangle public Rectangle3(int l, int w) { // initialize instance variables length = l; width = w; }

// return the height public int getLength() { return length; }

// return the width public int getWidth() { return width; }

// String to display when object is printed. /* public String toString() { return "The rectangle's dimensions are " + length + " X " + width; } */ }

Instructions: Modify the shape classes override the toString and equals methods. 1. Create a new project called 09.04 Assignment in the Module 09 Assignments folder. 2. Copy your Rectangle and Box classes to the newly-created folder. Rename each class to version 4. Be sure to change the file name and the class statement. 3. Create a client class to test the shape implementation classes. Add an appropriate main method. As this project is completed, declare new instances of a shape class as needed. You may have more than one instance of any given class. For instance, you may decide to test with three boxes and two rectangles. 4. The tester class needs to include a showEffectBoth static method. Use the sample programs as a model. The method needs to demonstrate toString method work. 5. Create a new class named Cube4 that extends Box4. A cube is a box where the value for its length, width, and height are all the same. Use the existing classes as a model. 6. Define two more implementation classes for shapes of your choice. Choose shapes within the quadrilateral or rectangular prism families. Use the existing implementation classes as a model. 7. Each implementation class must override the object class toString method by providing the name of the class followed by the shape's dimensions. 8. As needed, update the implementation classes to override the object class equals method, so that it can be determined when shapes are equal based on the values of their dimensions. Some classes should inherit the equals method. For instance Cube will inherit the equals method of the Box class rather than override it. Expected Output: The following image shows a sample of the output this project could display. The values and results will vary based on your program. - Blue): Terminal Window Options My shapes: Rectangle - 12 x 20 Box - 4 X 4 X 4 Box - 4 X 12 X 8 Cube - 4 X 4 X 4 - 12 X 1 - 18 X1 X1 Test for equality: Box - 4 X 4 X 4 IS same size as Cube - 4 X 4 X 4 Box - 4 X 12 X 8 is NOT the same size as Cube - 4 X 4 X 4 09.04 Overriding Methods Grading Rubric Points Possible Points Earned Components Comments include name, date, and purpose of the program. 1 The equals method properly overridden in needed classes. 3 The toString method properly overridden. 2 The Cube and two additional shape classes defined. 3 Tester program prints information about each object correctly. 1 Tester program demonstrates accuracy of the equals method. 2 No compiler errors. No runtime errors. Output is accurate. 2 Thoughtful PMR included. 1 Total 15

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!