云南大学软件学院实验报告姓名:学号:专业:软件工程日期:2014/10/29成绩:JAVA实验六实验目的:熟悉类的继承以及子类、抽象类的使用。会使用子类、抽象类,会使用相关构造方法。实验要求:Part1:putesthecostoftakingacollegecourse. IncludeaconstructorthatrequiresacourseIDnumber. putealabfeeforacoursethatusesalab. WriteaprogramUseCoursetousetheclasses. SavetheprograsasCollegeCourse,Lab,andUseCourse. PutthemallinapackagecalledForexample,theoutputcouldbe:Thecostofyourcourseis$$$:CreateanabstractAutoclasswithfieldsforthecarmakeandprice. Includegetandsetmethodsforthesefields;thesetPrice()methodisabstract. Createtwosuclassesforindividualautomobilemakers(forexample,FordandChevy)andincludeappropriatesetPrice()methodsineachsubclass. Finally,writeaprogramthatusestheAutoclassandsubclassestodisplayinformationaboutdifferentcars. SampleOutput:AnewFordcosts$$:四、实验总结:对类的继承机制和抽象方法有更具体的理解指导教师签名:
云南大学java实验6 来自淘豆网m.daumloan.com转载请标明出处.