A simple restaurant cash register system implemented in C++ that processes customer transactions, calculates taxes, handles payments, and tracks daily totals.
This console application simulates a point-of-sale system for Lakeview Restaurant. It allows users to process multiple customer transactions, calculating meal prices with tax, handling payment amounts, and providing change. At the end of the session, it displays grand totals including the number of customers served and total receipts collected.
- Transaction Processing: Process multiple customer transactions in a single session
- Tax Calculation: Automatic 8% tax calculation on meal prices
- Payment Handling: Accepts customer payment and calculates change
- Input Validation: Ensures valid meal prices (minimum $1) and sufficient payment amounts
- Session Totals: Tracks and displays total customers served and total receipts
- User-Friendly Interface: Clear prompts and formatted output for easy reading
- C++ compiler with C++11 support or later
- Examples: g++, clang++, MSVC (Visual Studio)
- Windows (Visual Studio project included)
- Linux/macOS (can compile with g++ or clang++)
- Open
homework4.vcxprojin Visual Studio - Build the solution (F7 or Build → Build Solution)
- Run the application (F5 or Debug → Start Debugging)
g++ -o restaurant homework4.cpp
./restaurantclang++ -o restaurant homework4.cpp
./restaurant- Start the Program: Run the compiled executable
- Process Customers:
- Enter
Yoryto process a customer - Enter
Nornto end the session
- Enter
- Enter Meal Price: Input the price of the meal (must be $1 or more)
- View Transaction Details: The system displays:
- Meal price
- Tax amount (8%)
- Total amount due
- Enter Payment: Provide the amount tendered (must be equal to or greater than total)
- Receive Change: The system calculates and displays the change
- End Session: Choose
Nwhen prompted to process another customer - View Grand Totals: See the total number of customers and total receipts for the session
*** Lakeview Restaurant ***
Do you want to process a customer ?
Enter N/n for No and Y/y for Yes: y
Enter the price of the meal: $15.50
Price of Meal: $15.50
Tax: $1.24
Total Amount: $16.74
Enter amount tendered: $20.00
Amount Tendered: $20.00
Total Amount: $16.74
---------------------------------
Change: $3.26
Do you want to process a customer ?
Enter N/n for No and Y/y for Yes: n
Grand Totals:
Total Customers: 1
Total Receipts: $16.74
*** Thank You ***
- Main Loop: Controls program flow and allows multiple customer transactions
- Input Validation: Ensures user inputs are valid (Y/N responses, valid prices, sufficient payment)
- Calculation Functions: Computes tax and totals with 8% tax rate
- Output Formatting: Uses
iomanipfor clean, aligned currency display
- Original Author: Robert Bennethum
- Course: CMPSC 121
- Assignment: Homework 4
- Original Description: Make a simple cash register
The tax rate is currently set to 8% and defined as a static constant:
static float TAXRATE = .08;To modify the tax rate, change this value in homework4.cpp and recompile.
This project was created as an educational assignment. Please respect academic integrity policies if using this code for learning purposes.