Question: Use the following specification to code a complete C++ module named CoffeeOrder : enum class CoffeeType { AmericanDark, AmericanRegular, Espresso, IceCoffee }; Basic Details Your

Use the following specification to code a complete C++ module named CoffeeOrder:

enum class CoffeeType { AmericanDark, AmericanRegular, Espresso, IceCoffee }; 

Basic Details

Your CoffeeOrder class includes at least the following data-members:

the address of a C-style null-terminated string of client-specified length that holds the barcode number of the coffee order (composition relationship).

Valid Barcode: any string that contains a dash '-'.

the type of coffee order using one of the enumeration constants defined above, defaulting to IceCoffee.

Public Member Functions

  • Default constructor

A custom constructor that receives as parameters:

  • the type of coffee order (optional);
  • the address of a C-style null-terminated string containing the coffee order barcode number.

A function named coffeeOrderCost.

If the current object is not in an empty state, this function calculates the coffee order cost according to the following rules:

  • AmericanDark coffee order costs 5$,
  • AmericanRegular coffee order costs 3.5$,
  • Espresso coffee order costs 7.5$,
  • IceCoffee coffee order costs 4$.

A class function named totalNoOfOrders returns the number of Espresso coffee orders that currently exist and have not yet been destroyed.

Other Features

Include in your design all special member functions required to manage your objects.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!