C++, cash register

profilejohn 66

 Create a class that implements a cash register. A user of the cash register object should be able to record the sale of up to 25 items. The program should loop until the user enters 'Q' to quit. When the user enters 'Q' the cash register should print the items and a total to the screen (don't worry about tax). 

 

The program should loop, asking the user what they would like to do. There are 3 options:

  • P - Prompt the user for an item. This includes the item name and price. Store this information in the cash register as a separate object (an CItem object). I recommend storing the CItem object in an array of CItems (or an STL vector of CItems if you wish).
  • C - Calculate and display the total of all items stored in the cash register object.
  • Q - Quit the program if the user enters 'Q'.

 

Your solution must contain the following:

  • A class named CRegister which contains a private (Links to an external site.) array of CItems. Use a function to add to the CItem to the CRegister class (something like 'void AddItem(CItem& item) { <your code goes here> }". You will also need a way to store the current number of CItems in the array. How you do that is up to you.
  • A class named CItems that stores private (Links to an external site.) variables: string called name and a double called price.
  • A function called "TotalMe" in the CRegister that loops over all of it's items and prints their name and the total.
  • A loop in main that loops until the user enters 'Q' or 25 items have been purchased.
  • Using only Accessor and Mutator (Links to an external site.) functions to get and set the data in the CRegister and CItem classes. 
  • 5 days ago
  • 20
Answer(1)

Purchase the answer to view it

blurred-text
NOT RATED
  • attachment
    gg123.cpp
  • attachment
    OOPTask.docx
Bids(98)