Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

1. What might have led to the misinformation?

Answered: 1 week ago