1
Practical Test Two TeaTime is a popular beverage company specialising in a tea based drinks. It offers its customers an extensive menu of different tea drinks, the price/cost of which is dictated by the size of the cup. Additionally, a charge of RM2.00 is applied to the total cost of the drink if the customer opts for a topping (i.e. jelly). The company is looking to develop a competitive advantage and is introducing ‘tea customisation’ for its customers. This will allow customers to add a number of toppings to their drink, with each additional topping adding RM 1.50 to the cost of the drink (determined by cup size). You are required to model this information provided above into a base class called Tea and two derived classes calledTeonMenu and CustomiseTea. In the base class, create 3 member functions as detailed below: One function to set the size and price of drink (Small=RM5.0, Medium=RM8.0, Large=RM12.0), as well as the number of toppings requested by the customer A pure virtual function to calculate the cost of the tea A function to display the total cost of the drink Derived classes will complete the calculation of the total cost of the beverage based upon the scenario presented above. Create a main function to test the virtual functions concepts, where the user will be prompted to order either a standard tea (with or without one topping) from the menu or customise their own drink. Based on the computer order an appropriate object will be created to calculate and display the total cost of the order.

LetsGetReadyNo.1

Embed Size (px)

DESCRIPTION

C++

Citation preview

Practical Test Two

TeaTime is a popular beverage company specialising in a tea based drinks. It offers its customers an extensive menu of different tea drinks, the price/cost of which is dictated by the size of the cup. Additionally, a charge of RM2.00 is applied to the total cost of the drink if the customer opts for a topping (i.e. jelly). The company is looking to develop a competitive advantage and is introducing tea customisation for its customers. This will allow customers to add a number of toppings to their drink, with each additional topping adding RM 1.50 to the cost of the drink (determined by cup size).You are required to model this information provided above into a base class calledTeaand two derived classes calledTeonMenuandCustomiseTea. In the base class, create 3 member functions as detailed below: One function to set the size and price of drink (Small=RM5.0, Medium=RM8.0, Large=RM12.0), as well as the number of toppings requested by the customer A pure virtual function to calculate the cost of the tea A function to display the total cost of the drinkDerived classes will complete the calculation of the total cost of the beverage based upon the scenario presented above.Create a main function to test the virtualfunctions concepts, where the user will be prompted to order either a standard tea (with or without one topping) from the menu or customise their own drink. Based on the computer order an appropriate object will be created to calculate and display the total cost of the order.