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)
}

A few things, it's shaping up :)
1. Switch blocks cannot take multiple characters, they only accept 1, so have the user enter in 1 letter or determine another method (e.g., if-elseif). While you are fixing that, move the code that you use to prompt the user after the case is decided (e.g.lines 54-56) outside of the switch block and just leave in the sumItem statement.
2. When calling a function you always need parentheses whether or not there are any parameters (so for line 36 should be displaymenu(); and I suspect for the others in that group as well).
3. The while on line 134 is not doing anything. If there are multiple statements under a while (or for, etc) you need to put them in braces {}
4. You have the idea with the while loop, but I think you need two of them, one inside the other, one for your menu system and the other for ordering the food

While (number !=3)
{
  Menu Display here
        
          while(response=='Y')
           {
                   prompt for orders
                   another item? (enter Y)
             }

}

So again, it seems like a lot but it's just a little shuffling around and then you'll be on your way

A few things, it's shaping up :)
1. Switch blocks cannot take multiple characters, they only accept 1, so have the user enter in 1 letter or determine another method (e.g., if-elseif). While you are fixing that, move the code that you use to prompt the user after the case is decided (e.g.lines 54-56) outside of the switch block and just leave in the sumItem statement.
2. When calling a function you always need parentheses whether or not there are any parameters (so for line 36 should be displaymenu(); and I suspect for the others in that group as well).
3. The while on line 134 is not doing anything. If there are multiple statements under a while (or for, etc) you need to put them in braces {}
4. You have the idea with the while loop, but I think you need two of them, one inside the other, one for your menu system and the other for ordering the food

While (number !=3)
{
  Menu Display here
        
          while(response=='Y')
           {
                   prompt for orders
                   another item? (enter Y)
             }

}

So again, it seems like a lot but it's just a little shuffling around and then you'll be on your way

I made some changes but here is where I am stuck on a few more things. The program accepts the order and totals the bill. Then I am adding sales tax. I have two problems I don't know how to solve. The order summary needs to be written to a log file that shows the time, date, number of items ordered, subtotal and tax. Then the order needs to clear so that a new ordered may be entered. I don't know how to put the information into a log file or add the time or date. I also don't know how to clear the old order. I think I'm really close but just don't know what to do next. I have to turn it in tonight. Any help is greatly appreciated. Here is my code.

#include<fstream>
#include<iostream>
#include<iomanip>
#include<string>
#include<cmath>

using namespace std;

//declare function prototypes
void operatorChoices();
void displayMenu();
void displayLogFile();
void endProgram();
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.05;
	double sum = 0.00;
	double total = 0.00;
	double quantity = 0.0;
	double payment = 0.00;
	double total = 0.00;
	char response;
	double salesTotal = 0.00;
	string menuItem;
	ofstream logFile;

	

	//display operator choices
	operatorChoices();
	cin >> number;


	switch (number)
	{
	case 1:
		cout << displayMenu();
		break;
	case 2:
		cout << displayLogFile();
		break;
	case 3:
		cout << endProgram();
		break;
	default:
		cout << "Invalid Entry" << endl;
	}

	while (number == 1)
	{
		displayMenu()
			cout << "Order an item: Y or N";
			cin >> response;
			cout << endl;

			while(response == 'Y' || response == 'y')
			{
				cout << "Enter the first 2 letters of "
					 << "the menu item the customer has ordered";
				cin >> menuItem;
				cout << endl;

				
				if(menuItem == ha || menuItem == HA)//Hamburger
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (2.29 * quantity);
				}
				else if(menuItem == ch || menuItem == CH)//Cheeseburger
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (2.49 * quantity);
				}
				else if(menuItem == sa || menuItem == SA)//Sandwich
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (3.99 * quantity);
				}
				else if(menuItem == fr || menuItem == FR)//French Fries
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.49 * quantity);
				}
				else if(menuItem == so || menuItem == SO)//Soup
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.75 * quantity);
				}
				else if(menuItem == la || menuItem == LA)//Large Drink
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (2.49 * quantity);
				}
				else if(menuItem == sm || menuItem == SM)//Small Drink
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.29 * quantity);
				}
				else if(menuItem == ca || menuItem == CA)//Cake
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (2.49 * quantity);
				}
				else if(menuItem == pi || menuItem == PI)//Pie
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (2.29 * quantity);
				}
				else if(menuItem == ic || menuItem == IC)//Ice Cream 
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.99 * quantity);
				}
				else if(menuItem == co || menuItem == CO)//Coffee
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.15 * quantity);
				}
				else if(menuItem == te || menuItem == TE)//Tea
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.05 * quantity);
				else
				{
					cout << "Invalid entry." << endl;
				}

				cout << "Order another item: Y or N ";
				cin >> response;
			}
			
			while(response != 'Y' || response != 'y')
			{
				//call the tax calculation function
				tax = calctax(salesTotal, rate);

				//call the total bill function
				total = calctotal(salesTotal, tax);

				//accept payment and calculate change
				cout << "Enter total payment received from customer ";
				cin >> payment;
				if (payment > total)
				{
					cout << "Change due is $"
						 << payment - total;
				}
				else 
					cout << "No change is due ";
				}
			}
		}
	while (number == 2)
	{
		displayLogFile();
	}

	while (number == 3)
	{
		endProgram();
	}

	return 0;
}

void operatorChoices()
{
	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;
}

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);
{
	double saleAmount;
	double taxAmount;

	return (saleAmount + taxAmount);
}
//function to display log file
displayLogFile();
{
	cout << date << time
	cout << totalQuantity << sumSalesTotal << sumTaxTotal << endl;
}

//function to end program
endProgram();
{

Since they are strings these all need to have quotes if(menuItem == "ha" || menuItem == "HA") //Hamburger

To make a log: create an ofstream object e.g., ofstream outfile("log.txt"); check if it's open if(outfile.is_open()) Then use outfile like it's a cout
e.g., outfile<<"Text to print to the file "<<yourvariablehere<<endl;
If you're using it in your functions, pass your ofstream object in (e.g., myfunc(param1,param2, ofstream & my_ofs)

To get the time you can use #include <ctime>. See here for an example to get time and date (ignore the printf, use cout or your ofstream instead).

Since they are strings these all need to have quotes if(menuItem == "ha" || menuItem == "HA") //Hamburger

To make a log: create an ofstream object e.g., ofstream outfile("log.txt"); check if it's open if(outfile.is_open()) Then use outfile like it's a cout
e.g., outfile<<"Text to print to the file "<<yourvariablehere<<endl;
If you're using it in your functions, pass your ofstream object in (e.g., myfunc(param1,param2, ofstream & my_ofs)

To get the time you can use #include <ctime>. See here for an example to get time and date (ignore the printf, use cout or your ofstream instead).

I added the "" for the string and I add <ctime>. I also tried to write the log file and complet the displayLogFile function. I don't know how to get the program to add up the quantity (total items sold) for each guest check. Please take a look at what I did and let me know if I still need to make changes. The program is not running so I know I have to find my errors. Thanks for pointing me in the right direction. I can't wait to see how this turns out once I get it running. Here is what it looks like now.

#include<fstream>
#include<iostream>
#include<iomanip>
#include<string>
#include<cmath>
#include<ctime>

using namespace std;

//declare function prototypes
void operatorChoices();
void displayMenu();
void displayLogFile(double totalQuantity, double salesTotal, 
					double tax, ofstream& logFile);
void endProgram();
double calctax(double saleAmount, double taxRate);
double calctotal(double saleAmount, double taxAmount);



int main()
{
	//declare variables
	int number = 0;
	double sale = 0.00;
	double tax = 0.00;
	double rate = 0.05;
	double sum = 0.00;
	double quantity = 0.0;
	double payment = 0.00;
	double total = 0.00;
	char response;
	double salesTotal = 0.00;
	string menuItem;
	ofstream logFile;
	time_t qTime;

	

	//display operator choices
	operatorChoices();
	cin >> number;


	switch (number)
	{
	case 1:
		cout << displayMenu();
		break;
	case 2:
		cout << displayLogFile(totalQuantity, salesTotal, tax, ofstream & my_ofs);
		break;
	case 3:
		cout << endProgram();
		break;
	default:
		cout << "Invalid Entry" << endl;
	}

	while (number == 1)
	{
		displayMenu()
			cout << "Order an item: Y or N";
			cin >> response;
			cout << endl;

			while(response == 'Y' || response == 'y')
			{
				cout << "Enter the first 2 letters of "
					 << "the menu item the customer has ordered";
				cin >> menuItem;
				cout << endl;

				
				if(menuItem == "ha" || menuItem == "HA")//Hamburger
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (2.29 * quantity);
				}
				else if(menuItem == "ch" || menuItem == "CH")//Cheeseburger
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (2.49 * quantity);
				}
				else if(menuItem == "sa" || menuItem == "SA")//Sandwich
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (3.99 * quantity);
				}
				else if(menuItem == "fr" || menuItem == "FR")//French Fries
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.49 * quantity);
				}
				else if(menuItem == "so" || menuItem == "SO")//Soup
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.75 * quantity);
				}
				else if(menuItem == "la" || menuItem == "LA")//Large Drink
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (2.49 * quantity);
				}
				else if(menuItem == "sm" || menuItem == "SM")//Small Drink
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.29 * quantity);
				}
				else if(menuItem == "ca" || menuItem == "CA")//Cake
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (2.49 * quantity);
				}
				else if(menuItem == "pi" || menuItem == "PI")//Pie
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (2.29 * quantity);
				}
				else if(menuItem == "ic" || menuItem == "IC")//Ice Cream 
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.99 * quantity);
				}
				else if(menuItem == "co" || menuItem == "CO")//Coffee
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.15 * quantity);
				}
				else if(menuItem == "te" || menuItem == "TE")//Tea
				{
					cout << "Enter the quantity ordered: ";
					cin >> quantity;
					cout << endl;
					salesTotal += (1.05 * quantity);
				}
				else
				{
					cout << "Invalid entry." << endl;
				}

				cout << "Order another item: Y or N ";
				cin >> response;
			}
			
			while(response != 'Y' || response != 'y')
			{
				//call the tax calculation function
				tax = calctax(salesTotal, rate);

				//call the total bill function
				total = calctotal(salesTotal, tax);

				//accept payment and calculate change
				cout << "Enter total payment received from customer ";
				cin >> payment;
				if (payment > total)
				{
					cout << "Change due is $"
						 << payment - total;
				}
				else 
					cout << "No change is due ";
				}
				ofstream outfile("log.txt");
		
				if (outfile.is_open())
				{
				outfile << "Total items sold is " << totalQuantity << endl;
				outfile << "Total sales before tax is $" << salesTotal << endl;
				outfile << "Total tax on sales $" << tax << endl;
				}
			}
		}
	while (number == 2)
	{
		displayLogFile(totalQuantity, salesTotal, tax, logFile)
	}

	while (number == 3)
	{
		endProgram();
	}

	return 0;
}

void operatorChoices()
{
	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;
}

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);
{
	double saleAmount;
	double taxAmount;

	return (saleAmount + taxAmount);
}
//function to display log file
void displayLogFile(void displayLogFile(double totalQuantity, double salesTotal, 
					double tax, ofstream& logFile);
{
    // Get the number of seconds since midnight Jan. 1, 1970
    time(&qTime);
    // Convert the seconds to a string which describes the local time
    char* cpLocalTime = ctime(&qTime);
    cout << "The local time is " << cpLocalTime << endl;

	cout << totalQuantity << sumSalesTotal << sumTaxTotal << endl;
}

//function to end program
void endProgram();
{
}

To get the quantities (I assume you only want total number of items rather than the total number of each?) For that you can put a counter at the end of your ordering while loop so it increments. When you are calling your function you can leave off the ofstream & designator (but you do need it in the declaration up top, so leave that one alone).

In the menu don't put cout<< displaymenu(), just put displaymenu();
otherwise cout would need the displaymenu to return a string in this case.

void displayLogFile(void displayLogFile(double totalQuantity, double salesTotal, double tax, ofstream& logFile); something is awry there, I think you just pasted twice. This also needs to be called as displayLogFile() and not cout'ed

And when you call it, use logfile instead of my_ofs, that doesn't exist

There are some missing semicolons and a mismatched brace I think. Your function _definitions_ (at the bottom) do not need a semicolon after them. You don't need to (and shouldn't) redeclare saleAmount and taxAmount in calctotal(). You will override anything in the parameters.

Do you have the final code for this?

Could you please help us solve this post??
Many of us are taking this class online and receive little to no help understanding what in fact we are doing. I am beyond struggling and can only ask for what may be an easy solution from you. I can get down to one error but it changes as soon as I solve that particular problem. I've gotten everything from 2660, 2064, 4430, etc. I do not have the answer nor the understanding to solve this. I only ask for your help as they're are atleast 5 of us clinging onto your every post!!

Could you please help us solve this post??
can only ask for what may be an easy solution from you.

You are doing yourself a great disservice with this attitude. You will not learn anything if you just assimilate a solution.

I can get down to one error but it changes as soon as I solve that particular problem.

This often happens unfortunately. Keep attacking the errors starting from the first each time this happens, some of the "downstream" errors clear.

I do not have the answer

Neither do I, but if you post your own code (hint: not reposting stefanies hard work) and the specific errors you are facing (the more specific the better) you can receive help from myself or any other member here.

nor the understanding

I'm sure you have the understanding and if not read your text or do a net search on what you need. There are zillions of code examples out there. I've taken online classes before and I understand some of your frustration but you have your instructor's email and probably a way to contact your classmates (just don't exchange email addys in the posts themselves, that's not allowed).

So, in sum, keep at it and start your own post with what you've got and the specific problems you are having.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.