I am trying to write a point of sale program. I need to display the menu, the operator enters the lunch order. Total bill is calculated with sales tax, customer payment is accesped and change (if any) is calculated. order summary should be written to a log file that includes the date, time, number of items sold, the order total without tax, and the tax amount. Log file should be displayed. Then the last order should be cleared and a new order can begin. At the end of the day the operator will select to "end the program". I am very overwhelmed. Here is what I have so far. I'm looking for some confirmatio on what I've written and a bump in the right direction of where to go from here. Sorry, it's kind of messy. If I'm posting this incorrectly could someone please let me know? Thanks.
#include<iostream>
#include<iomanip>
#include<string>
#include<cmath>
using namespace std;
//declare function prototypes
displayMenu();
double calctax(double saleAmount, double taxRate);
double calctotal(double saleAmount, double taxAmount);
int main()
{
//declare variables
int number;
double sale = 0.00;
double tax = 0.00;
double rate = 0.0;
double sum = 0.00;
double total = 0.00;
double quantity = 0.0;
char response;
double sumItem = 0.00;
char menuItem;
//display operator choices
cout << "Enter 1 to start the data entry mode " << endl;
cout << "Enter 2 to display the log file " << endl;
cout << "Enter 3 to Quit the program " << endl;
cin >> number;
if (number ==1)
displayMenu;
else if (number == 2)
displayLogFile;
else if (number == 3)
endProgram;
else
cout << "Invalid Entry" << endl;
//Ask operator for orders
cout << "Enter the first letters of the menu item ";
<< "the customer has ordered: ";
cin >> menuItem;
cout << endl;
switch (menuItem)
{
case 'ha':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 2.29 * quantity;
break;
case 'ch':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 2.49 * quantity;
break;
case 'sa':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 3.99 * quantity;
break;
case 'fr':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 1.49 * quantity;
break;
case 'so':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 1.75 * quantity;
break;
case 'la':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 2.49 * quantity;
break;
case 'sm':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 1.29 * quantity;
break;
case 'ca':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 2.49 * quantity;
break;
case 'pi':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 2.29 * quantity;
break;
case 'ic':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 1.99 * quantity;
break;
case 'co':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 1.15 * quantity;
break;
case 'te':
cout << "Enter the quantity ordered: ";
cin >> quantity;
cout << endl;
sumItem = 1.05 * quantity;
break;
default:
cout << "Invalid entry." << endl;
}
cout << "Order another item: Y or N";
cin >> response;
cout << endl;
while ( response == 'Y')
cout << "Enter the first letters of the menu item "
<< "the customer has ordered: ";
cin >> menuItem;
cout << endl;
//call the tax calculation function
tax = calctax(sale, rate);
//call the total bill function
total = calctotal(sale, tax);
return 0;
}
void displayMenu()
{
cout << "Hamburger $2.29" << endl;
cout << "Cheeseburger 2.49" << endl;
cout << "Sandwich 3.99" << endl;
cout << "French Fries 1.49" << endl;
cout << "Soup 1.75" << endl;
cout << "Large Drink 2.49" << endl;
cout << "Small Drink 1.29" << endl;
cout << "Cake 2.49" << endl;
cout << "Pie 2.29" << endl;
cout << "Ice Cream 1.99" << endl;
cout << "Coffee 1.15" << endl;
cout << "Tea 1.05" << endl;
}
//function to calculate sales tax
double calctax(double saleAmount, double taxRate)
{
return (saleAmount * taxRate);
}
//function to calculate total sale
double calctotal(double saleAmount, double taxAmount);
{
return (saleAmount + taxAmount)
}