You are on page 1of 2

Assignment9:Inheritance

ElectroniccopydueFriday4/24@9am

PrintedcopydueFriday4/24@beginofyourlabsection

FOLLOWDIRECTIONSCAREFULLY

FollowPROGRAMMINGGUIDELINES.Readallstepscarefully.

FollowSUBMISSIONGUIDELINES.Readallstepscarefully.

DrawclassUMLchart.SeeQuickUML.pptxunderclasslectures.

YouMUSTusemodules.YouMUSTusefunctionaldecomposition,ifapplicable.

Youmayuseseparatefunctionstocompleteeachquestion,ifapplicable.

Eachclassinitsownfile.

Followpropernaming.Remember:

variables=snake_caseorlowerCamelCase

functions=snake_caseorlowerCamelCase

modules=snake_caseorlowerCamelCase

classesandclassfiles=Upper_Snake_CaseorUpperCamelCase

Hint:Whenyouinstantiateaclass,youaresavingthatintoavariable.

InheritanceandClasses(100pts)

Allclassesmusthave

1.constructor(__init__)

2.accessor(getter),mutator(setter)foreachattribute(whenappropriateinyourdesign)

3.objectstate(__str__)

Youaretaskedtoimplementsimplepayrollprocessingfordifferentkindsofemployees.


A.Eachemployeehasanemployeenameandemployeenumber.

B.Hourlyemployeesarepaidhourlyrate.

C.Salariedemployeesarepaidafixedsalarynomatterhowmanyhourstheywork.

D.Managersaresalariedemployeesandarepaidasalaryplusbonus.

Yourtestmoduleshouldtestallofyourclassescompletely.Itshouldtestallsetters,getters,

constructorsandobjectstatesforallclasses.Createatleast2differentinstanceofeachclass
with

differentattributevaluesforeachinstanceandtesteachclassmethod.Youshouldseparate
testinginto

functions.Eachfunctionshouldtestoneclass(class!=instance).Ineachtestfunction,you
instantiatea

class2times,assigndifferentattributevalues,andtestclassmethods.

Hints:

Youneedtouseinheritancehere.

Thinkaboutwhatasuperclasscouldbeandwhatsubclassescouldbe.

Thinkaboutcommonattributesforallclasses(subclasses).

Thinkaboutattributesthatonlybelongintosubclasses.

Doyouneedpolymorphismforanysuperclassmethods?

a.onlygettersandsettersneednarratives(forassignments)

You might also like