CP Lab 8.docx - National University O f C o m p u t e r &...

This preview shows page 1 - 3 out of 6 pages.

National UniversityO fC o m p u t e r&E m e r g i n gS c i e n c e sF a i s a l a b a d - C h i n i o tC a m p usCL-103Computer ProgrammingLab # 8Objectives:Multilevel inheritanceSingle level inheritanceCompositionAccessorMutator functionsPractice Problems.Note: Carefully read the following instructions (Each instruction contains aweightage)1.There must be a block of comments at start of every question's code; the block should containbrief description about functionality of code.2.Proper indentation of code is essential3.Variable name should be meaningful4.Make a Microsoft Word file and past all of your C++ code with screenshot of outputs in MSword.5.First think about statement problems and then write/draw your logic on copy.6.After copy pencil work, code the problem statement on MS Studio C++ compiler.7.At the end when you done your today lab tasks, attached only MS word file and make yoursubmission on slate.8.Late and email submission is not accepted. All tasks must be submitted during the lab time.
National UniversityO fC o m p u t e r&E m e r g i n gS c i e n c e sF a i s a l a b a d - C h i n i o tC a m p usProblem 1: (multilevelinheritance, accessor and mutator functions)Design the following classes with given variables and methods using inheritance.Setters and Getters are used to access private variables of class to set and get their values .Note:In Main, use the object of truck class to access all the data and functions of all inheritedclasses .And Create the object of wing Vehicle to access all the functions of Vehicle.Explain your work with proper output.Problem 2:(Single Level Inheritance, accessor and mutator functions)A retail store has a preferred customer plan where customers may earn discounts on all theirpurchases. The amount of a customer’s discount is determined by the amount of the customer’scumulative purchases in the store.When a preferred customer spends $500, he or she gets a 5% discount on all future purchases.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 6 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Spring
Professor
Sarim baig
Tags
Method

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture