Question: You need to copy my main method, Rectangle and RectPrism into your project folder. You dont need to change my main method. Additional methods or

  1. You need to copy my main method, Rectangle and RectPrism into your project folder. You dont need to change my main method. Additional methods or adjustments may need to be made in order to implement the diagonalDistance method. The other methods should be implemented without adjustments to Rectangle!!!!!!!!!!!!! Violations of this expectation will result in point deductions!
  2. Notes and method-headers are provided, to guide you through the implementation of our child class RectPrism.
  3. Upon completion of these implementations to RectPrism, copy RectPrism class, the executable and turn in through Schoology.

Main Method:

public static void main(String[] args) {

Rectangle r1 = new Rectangle(10.2, 11.6);

RectPrism p1 = new RectPrism(12.7, 14, 4.1);

RectPrism p2 = new RectPrism(3, 3, 3);

System.out.printf("The area of r1 is: %.2f ", r1.area());

System.out.println("The preimeter of r1 is: " +r1.perimeter());

System.out.println("Now lets calculate some volumes! ");

System.out.printf("The volume of p1: %.2f ", p1.volume() );

System.out.printf("The SA of p2: %.2f ", p2.SA());

}

Rectangle:

/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */

/** * * @author 842879 */ public class Rectangle { private double length; private double width; //Default constructor setting attributes to zero //******************************************** public Rectangle () { length = 0; width = 0; } //Constructor with lenght and width passed as paremeters //****************************************************** public Rectangle (double l, double w) { length = l; width = w; } //This method edits the length of your object //***************************************** public void changeLen(double l) { length = l; } //This method edits the width of the rectangle //******************************************* public void changeWid(double w) { width = w; } //using this method will calculate the area of our rectangle object //************************************************************* public double area () { return length * width; } //using this method will calculate the perimeter of our rectangle //*************************************************************** public double perimeter() { return 2*length + 2*width; } }

RectPrism:

public class RectPrism extends Rectangle {

private double height;

public RectPrism (double l, double w, double h)

{

super(l, w);//We need to use the parent constructor in order to give life to parents attributes!

height = h;

}

//This method will calculate the volume of the rect. prism and returning as a double

public double volume()

{

}

//This method will calculate the SA of the rect. prism returning as a double

public double SA()

{

}

}

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!