Question: In this lab assignment, you are asked to write java code of given classes in the following class diagram. You are given an UML diagram

 In this lab assignment, you are asked to write java codeof given classes in the following class diagram. You are given an

In this lab assignment, you are asked to write java code of given classes in the following class diagram. You are given an UML diagram that expresses relationship between three classes. Circle class is the parent class of the Curve and Cylinder classes. Also, you are given Circle.java and testInheritance.java files. Examine the given UML diagram and code. 1) Add variable definitions to the Circle class. Be careful about accessibility modifiers given in the UML. 2) Implement the getArea method. The method will initially print the message: name_of_the_class + "getArea method is invoked". Then, it will calculate and return the area of the circle by the formula area =r2. Note: You can retrieve the name of the class by this.getClass().getSimpleName(). 3) Implement Curve and Cylinder classes as given in the UML diagram. a. getArea method in the Curve and Cylinder class will initially print the message: name_of_the_class + "getArea method is invoked". b. Then, it will calculate the area of the object and return it. c. Area formulation for cylinder: A=2r(h+r) ( h stands for height) d. Area formulation for curve: A=(/360)r2( stands for angle) 1 TED UNIVERSITY e. draw method of Curve and Cylinder classes will initially call the parent class' draw method. Note: Your can access the method of the parent class by super.method() f. Then, it will print one of the following strings: "This method is overloaded with an double parameter the value is: " + val "This method is overloaded with an int parameter the value is: " + val 4) Complete the testlnheritance class to produce the following output. Add calls to getArea and draw methods and print the calculated areas

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!