Question: HW: Given the class diagram and progDemo below: Shape re: double circumference: double A Square side double Square double area: double circunference: double Circle -adu
HW: Given the class diagram and progDemo below: Shape re: double circumference: double A Square side double Square double area: double circunference: double Circle -adu double pe double Credouble) we double circunference) double Cylinder height double -Cylinder double double area: double circunference(: double File progDemo java public class progDemo public static void main(String [] args) { Shape sh = new Circle(1); System.out.println("The circle's area : " + sh.area()); System.out.println("The circle's circumference: " + sh.circumference()); sh = new Cylinder (2,2); System.out.println("The cylinder's area: "+sh.area()); System.out.println("The cylinder's circumference: sh.circumference()); sh = new Square (4); System.out.println("The square's area: "+sh.area()); System.out.println("The square's circumference: + sh.circumference()); ) Requirements: Add class Square implementing the Shape interface O Area = Side circumference = 4* side Add class Cylinder inheriting the Circle class o Area = 2 trh + 27tr , circumference = 27r Run the code in file progDemo for testing. The Output Of the Program: The circle's area: 3.14 The circle's circumference: 6.28 The cylinder's area: 50.24 The cylinder's circumference: 12.56 The square's area: 16.0 The square's circumference: 16.0 Submit you whole work, on the LabTask and HW, to the blackboard
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
