Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions