Question: Task 1 Circle -radius:double = 5.0 -color:String = Green +Circle() +Circle(radius:double) +Circle(radius:double, color:String) +getRadius():double +setRadius(radius:double):void +getColor():String +setColor(color:String):void +getArea():double Cylinder -height:double = 1.0 +Cylinder() +Cylinder(radius:double, height:double)

Task 1

Circle

-radius:double = 5.0

-color:String = Green

+Circle()

+Circle(radius:double)

+Circle(radius:double, color:String)

+getRadius():double

+setRadius(radius:double):void

+getColor():String

+setColor(color:String):void

+getArea():double

Cylinder

-height:double = 1.0

+Cylinder()

+Cylinder(radius:double, height:double)

+Cylinder(radius:double, height:double, color:String)

+getHeight():double

+setHeight(height:double):void

+getVolume():double

For task 1, implement the two classes (Circle and Cylinder) that are described above. Note that class Cylinder is derived from the superclass Circle -- in other words Cylinder inherits from Circle. Make sure that the subclass Cylinder invokes the superclass' constructors (via super() and super(radius)) and correctly inherits the variables and methods from the superclass Circle.

Task 2

Person

-name:String

-address:String = String

+getName():String

+getAddress():String

+setAddress(address:String):void

+setName(name:String):void

Staff

-school:String

-pay:double

+Staff(name:String, address:String, pay:double)

+getSchool():String

+setSchool(school:String):void

+getPay():double

+setPay(pay:double):void

+toString():String

Student

-program:String

-year:int

-fee:double

+Student(name:String, address:String, program:String, year:int, fee:double)

+getProgram():String

+setProgram(program:String):void

+getYear():int

+setYear(year:int):void

+getFee():double

+setFee(fee:double):void

+toString():String

For task 2, implement the three classes (Person, Student, and Staff) that are described above. Note that classes Staff and Student are derived from the superclass Person -- in other words Staff and Student inherit from Person. Make sure that the subclasses Student and Staff invoke the superclass' constructors and correctly inherit the variables and methods from the superclass Person. Also note that Person is an abstract class.

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!