Question: Question 1 In this lab assignment, you are asked to write java code of given classes in the following class diagram. Circle # radius: double

Question 1
In this lab assignment, you are asked to write java code of given classes in the following class diagram.
Circle
# radius: double
# color: String
+ PI:double
+ getRadius(): double
+ setRadius(radius:double): void
+ getColor():String
+ setColor(color:String): void
+ getArea():double
+ draw():void
```
Curve
- angle: double
+ getAngle(): double
+ setAngle(angle:double): void
+ getArea():double
+ draw(val:double):void
```
```
Cylinder
- height: double
+ getHeight(): double
+ setHeight(height:double): void
+ getArea():double
+ draw(val:int):void
```
Instructions:
- Create classes with defined attributes.
- Write the methods of classes according to the given signatures,
-\(\quad \) Pl as a constant final attribute. (PI=3.14)
- You can get class name using the following code in java:
- this.getClass().getSimpleName();
- The methods draw(), getArea() give information when it is invoked. It prints out the class name and "...method is invoked ".
- i.e. draw() method has the following line:
System.out.println(this.getClass().getSimpleName()+" draw method is invoked");
Question 1 In this lab assignment, you are asked

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 Programming Questions!