Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab7 Computing III Lab-7 Suppose you have a class Sale and there are two types of Sale OnlineSale class and StoreSale clas:s (inherited from Sale).

Lab7image text in transcribed

Computing III Lab-7 Suppose you have a class Sale and there are two types of Sale OnlineSale class and StoreSale clas:s (inherited from Sale). Suppose you have a method, bill), which is pure virtual in Sale and a virtual method, calculateTax), in Sale. Suppose that tax is 10% in online sales and 20% in store sales. Suppose that bill in online sales includes address also (not required in store sales). Suppose that StoreSale is of two types WholesaleStoreSale and RetailStoreSale (inherited from StoreSale). StoreSale has a (non- virtual) method calculateDiscountedValue which calculates the discount of 25% on wholesale store sale and discount of 10% on retail store sale. You may other assume more information to make your program output more presentable.) 1. 2. Can you make objects of class Sale? Why or why not? Write a test for it. Can we leave a pure virtual function not implemented in derived class (considering one descendent)? What about the case of virtual function? 3. Is it necessary for all virtual functions that are non-pure to have some definition? 4. Which of the methods in our example provide late binding? 5. Is calculateTax() automatically virtual in StoreSale class? 6. Which is overriding in the above example? Display values from base and from override to distinguish Which is redefining in the above example? Display values from base and from override to distinguish Print any output from online sale, wholesale store sale and retail store sale. Suppose we do not want a virtual function to be overridden. Which keyword will we add? 7. 8. 9

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

? Solve the following: a. (36!)/(31!)= b. 10P7= c. 7C4=

Answered: 1 week ago

Question

Introduce and define metals and nonmetals and explain with examples

Answered: 1 week ago

Question

What is IUPAC system? Name organic compounds using IUPAC system.

Answered: 1 week ago

Question

What happens when carbonate and hydrogen react with carbonate?

Answered: 1 week ago