Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PART 2-4 Project 2-part 2 In this part, a subclass called Cylinder. Cylinder is derived from the superclass Circle as shown in the class diagram
PART 2-4
Project 2-part 2 In this part, a subclass called Cylinder. Cylinder is derived from the superclass Circle as shown in the class diagram (where an an arrow pointing up from the subclass to its superclass). Create class Circle and class Cylinder like the following diagram. You can reuse the Circle class that you have created in the previous exercise. Make sure that you keep "Circle.class" in the same directory Design a class TestCylinder, and let users to create 2 instances of class Cylinder by asking appropriate questions from the user. Now, for each Cylinder, print the appropriate information in a file named Cylinder-label.txt (label is the label of the Cylinder.) Circle -radius: double color: String "green" abel: String "al" +Circle0 +Circle(redouble) rcle(r:double, c strin strin +getRadius 0: double +get Area(): double +getCircumference 0: double +getLabel0: String tsetLabel(I:String): void extend Cylinder he double-1.0 +Cylinder() Cylinder (r:double) Cylinder height:double, radius:double) Cylinder (height: double, radius:double, color string, label stringD +getHeight0: double +setHeight(height: double): void e0:double "Cylinder radius r, height-h, colorac, labelal" +toStrina String Project 2-part 3 Create class Shape, Circle, Rectangle, and Square like the following diagram. Write a test class to test all the methods defined in Shape, Circle, Rectangle, and Square. About a toString0 method: In class Shape:A toString0 method that returns A Shape with color of xx and filledNot filled In class Circle: Override the toString0 method inherited, to return "A Circle with radius xxx, which is a subclass of yyy", where yy is the output of the toString0 method from the superclass. In class Rectangle: Override the toString0 method inherited, to retum "A Rectangle with width xxx and length azz, which is a subclass of yyy", where yyy is the output of the toString0 method from the superclass. In class Square: Override the toString0 method inherited, to return "A square with side xxx, which is a subclass of yyy", where yyy is the output of the toString0 method from the superclassStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started