Question: Because RectangularPrism implements Shape, Eclipse has populated the class with two methods which Override the interface methods. Without the existence of these methods, we would

Because RectangularPrism "implements" Shape, Eclipse has populated the class with two methods which "Override" the interface methods. Without the existence of these methods, we would encounter a compiler error (try removing one of the methods to see this "contract" enforcement in action). Add a constructor to this class:

RectangularPrism(double width, double height, double length)

Finally, complete the two methods by using the volume and surface area formulas for a rectangular prism:

v = whl

A = 2(wl + hl + hw)

Because RectangularPrism "implements" Shape, Eclipse has populated the class with two methods

JPizza.java ShapeHandler.ja PizzaType.java "1 Main.java PizzaModified.java Shape.java 1 package oop.PizzaModified; 1 package oop.PizzaModified; 3 public class PizzaModified { 4 3 public enum PizzaType f 4 HAWAIIANC10), MEATLOVERSC12), VEGETARIANC9); // Private properties private int price; private String type; private int price; PizzaType(int price) f this.price price 8 /7 Constructs a Pizza object with a price and a 9public PizzaModified(int price, String type) 10 10 this.price price; this.type type; 12 public int priceO 13 14 15 12 13 14 15 public int priceO 16 17 18 19 return price; // Gets the price of the pizza return price; //Gets the type of the pizza public String typeO 21 return type; 23 1

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!