Question: SOLGO Based on the UML class diagram and specification given below, write a complete Java program conqa shivong s Shapes2D +calArea():double Shape -width: double
SOLGO Based on the UML class diagram and specification given below, write a complete Java program conqa shivong s Shapes2D +calArea():double Shape -width: double -length: double ii. mush +setWidth() +selLength() Hof Pavalkoller: Shapes3D 101 -height: double +setHeight(double); void +calArea(): double a) Define set methods in class Shape. (1 mark) b) Define methods calArea() with formula area = width * length for class Shapes2D. (Hint: use super keyword) aldobilo (1.5 mark) =) Define methods calArea() with formula calVolume, volume = width*length*height for class Shapes3D. (Hint: use super keyword) (2 marks) d) Define a main class and do the followings: Create 1 object Shape. Assign width with 2.5 and length with 3.1 by calling the set methods. (1.5 mark) Create 1 object Shapes2D. Call calArea method and display the result. (1.5 mark) Create 1 object Shapes3D. Assign height with 2.0 by calling the set methods. Call calArea method and display the result. (2.5 marks)
Step by Step Solution
There are 3 Steps involved in it
sent describes a scenario where you need to write a Java program based on a UML class diagram The classes involved are Shape Shapes2D and Shapes3D Heres a breakdown of the information provided in the ... View full answer
Get step-by-step solutions from verified subject matter experts
