Question: Pinal txan 40 pointa Question Schoolkid that is the base class tor children at a school. it should have teacher, and a greeting. It attributes
Pinal txan 40 pointa Question Schoolkid that is the base class tor children at a school. it should have teacher, and a greeting. It attributes for the chiid's name and age, the nane of the child's should have appropriate acceasor and mutator nethoda for each of the attributes ) Derive a class Exaggerat ingkid trom schoolkid. The new class should override the accessor . It also should override the accessor for method for the age, reporting the actual age plus a the greet ing, returning the child'a greet ing concatenated with the words I an the best. )Create teating class 40 points Question 2 abatract nethod computeDiscount that will return the discount from the purchase ot a given number of a singie item. The method has two parameters, count and itemcost a) create an abstzact class Diacount Policy. It should have a single It should have a conatructor that b) Derive a class buywztemadetOneFree from Discount Policy. has a single parameter n The data member of this class will be n. in addition, the elass should define the method computeDiscount so that every nth item is free. For example, if n is 3 and the eustomer buys 7 items and the cost of each item is s10, then the discount will be $20 aince every 3rd iten will be tree. If n ia 4 and the cost of each item is $10 and if the user buys 7 items, then the discount will be $10. c) Create teating class Question #3 20 points Create a LeftArrow class that derives from the Shape class tail 8 head 11 head/2 5 head/2-1 4 0 1 3 head/2-2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
