Practice Answer the following questions in a text or word processing file. 1) As
ID: 3703958 • Letter: P
Question
Practice
Answer the following questions in a text or word processing file.
1) As a software developer, you are responsible for designing classes to match the problem to be solved. In a prior solution for a bank, the following inheritance hierarchy was defined for the relevant classes:
bankTransaction
deposit
depositToSavings
depositToChecking
loanPayment
paymentToAutoLoan
paymentToMortgage
withdrawal
withdrawalfromTeller
ATMWithdrawal
balanceRequest
Each identifier in this list was implemented as a class and you represented the superclass and subclass relationship with the indentation.
Your current project invokes classes to store information on computer peripherals for a hardware supplier. The primary superclass is titled MedicalProfessional. Numerous subclasses are to be defined. These are named:
Surgeon, Pharmacist, SportsTherapist, Nurse, Therapist, FamilyDoctor, MedicalProfessional,PhysicalTherapist, Doctor, SurgicalNurse
Write the inheritance hierarchy for the MedicalProfessional family of classes. Use indentation to define the superclass/superclass relationship.
2) Below is a set of classes. For each set, define the relationships between the items asis-a (inheritance) versus has-a (aggregation). Note, to make sense you may want to reorder any one set.
a) Fruit, Apple, RedDelicious
b) Car, Tires, Engine
c) House, Garage, Bathroom, Basement
d) Structure, House, Log Cabin
e) Republican, Politician, Democrat, Independent
f) Enemy, Weapon, Target, Battle Game, Escape Route
Explanation / Answer
1.
MedicalProfessional
Therapist
SportsTherapist
PhysicalTherapist
Nurse
SurgicalNurse
Doctor
FamiliyDoctor
Surgeon
Pharmacist
2.
a) Apple IS-A Fruit
Apple IS-A RedDelicious
b) Car HAS-A Tires
Car HAS-A Engine
c) House HAS-A Garage
House HAS-A Bathroom
House HAS-A Basement
d) House HAS-A Structure
House HAS-A Log Cabin
e) Republican IS-A Politician
Democrat IS-A Politician
Independent IS-A Politician
f) Enemy HAS-A Weapon
Battle Game HAS-A Target
Battle Game HAS-A Escape Route
Battle Game HAS-A Enemy
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.