Good day:
My infile contains the following:
U
Apple Pie
1.29
A
Bacon Burger
3.45
V
Burrito
2.09
S
Cheeseburger, Double
3.59
W
Cheeseburger, Regular
2.95
Y
Chicken Nuggets
1.87
H
Chicken Sandwich
3.33
C
Chili, Bowl
2.12
X
Chili Dog
2.29
N
Chocolate Milk
0.98
D
Coffee
1.09
R
Fries, Large
1.89
F
Fries, Small
1.19
Q
Hamburger
2.45
Z
Hot Dog
1.99
T
Onion Rings, Large
2.59
G
Onion Rings, Small
1.57
J
Peach Pie
1.29
I
Potato, Baked
1.47
P
Salad, Regular
3.69
K
Salad, Side
1.95
M
Shake, Large
1.98
B
Shake, Small
1.49
O
Soft Drink, Large
1.69
L
Soft Drink, Regular
1.49
E
Soft Drink, Small
1.06
The assignment:
You are familiar with computer-driven systems used by cashiers in fast food restaurants. In this
project, you will plan and write a program that will simulate such a point-of-sale device. Here's how
it will work.
When a customer orders, the cashier presses a key for each item ordered (WITHOUT PRESSING
<ENTER>). If more than one of the same item is ordered, the key is pressed an appropriate
number of times. As each key is pressed, the name of the item and its price are displayed on the
next available line on the monitor. Typically, a customer might order a sandwich, then fries or
onion rings and finally, a drink or dessert.
After the customer finishes ordering, a key is pressed to indicate that the order is finished. The
computer at this point displays the amount of the bill, then a 6% sales tax and a total of the order
(amount plus tax). The customer gives the cashier money, the cashier enters the amount given
(tendered). The computer calculates and displays the amount of change that should be returned
to the customer. lf the amount of money tendered is insufficient to cover the total, the program
should alert the cashier to this fact and request re-entry of the tendered amount. The program will
then print the entire order and transaction to the printer so that the customer can have a receipt.
The letters, names and prices of the different menu items must be read in from a file named
"food.txt" and be stored in three parallel arrays and then accessed as needed.
The EQUAL KEY ( = ) will be used as the key to indicate that the order is finished. The items in
the disk file or the arrays must NOT be displayed as a menu on the screen. The following is an
alphabetical list of the food items offered for sales along with their respective key letters and
prices.
KEY ITEM PRICE
U Apple Pie 1.29
Q Hamburger 2.45
A Bacon Burger 3.45
Z Hot Dog 1.99
V Burrito 2.09
T Onion Rings, Large 2.59
S Cheeseburger, Double 3.59
G Onion Rings, Small 1.57
W Cheeseburger, Regular 2.95
J Peach Pie 1.29
Y Chicken Nuggets 1.87
I Potato, Baked 1.47
H Chicken Sandwich 3.33
P Salad, Regular 3.69
C Chili, Bowl 2.12
K Salad, Side 1.95
X Chili Dog 2.29
M Shake, Large 1.98
N Chocolate Milk 0.98
B Shake, Small 1.49
D Coffee 1.09
O Soft Drink, Large 1.89
R Fries, Large 1.89
L Soft Drink, Regular 1 .49
F Fries, Small 1.19
E Soft Drink, Small 1.06
On the reverse side is a sample receipt so that you can design your output accordingly. Naturally,
the name of your restaurant should reflect your LAST name and show some IMAGINATION and
ORIGINALITY.
The output is suppose to look like this(as an example):
Zandiago’s Z-BURGER SHACK
Date: Oct 25-07 Time: 18:31:26
Hamburger .............................. 2.45
Salad, Regular ......................... 3.69
Cheeseburger, Regular .................. 2.95
Soft Drink, Regular .................... 1.69
Soft Drink, Small ...................... 1.06
Potato, Baked .......................... 1.47
Fries, Large ........................... 2.59
Apple Pie .............................. 1.29
Onion Rings, Large ..................... 2.59
Chicken Nuggets ........................ 1.87
Amount 20.95
6% Sales Tax 1.26
Total 22.21
Amount Tendered 25.00
Change 2.79
THANK YOU FOR VISITING
Zandiago’s ZBURGER SHACK
So far:
#include <iomanip>
#include <cmath>
#include <fstream>
#include<string>
#include<iostream>
#include<conio>
float Tax;
float subtotal;
float total;
float price;
using namespace std;
/*functions protypes*/
void enterItemPrice();
void subTotal();
void calculatetax();
void totalprice();
void output();
int main()
{
cout<<"Zandiago's Z-Burger Shack"<<endl;
enterItemPrice();
subTotal();
calculatetax();
totalprice(total);
output();
return 0;
}
void enterItemPrice()
{
while ((targetletter = getch())!='=')
}
void subTotal()
{
return subtotal;
}
void calculatetax()
{
Tax = subtotal * TaxRate;
}
void totalprice()
{
total= Tax + subtotal;
}
void output()
{
cout<<item<<endl;
cout<<"------------------------------------------"<<endl;
cout<<total<<price<<endl;
cout<<"6 % Sales Tax"<<Tax<<endl;
cout"============================================"<<endl;
cout"Total"<<subtotal<<endl;
cout<<"Amount tendered"<<cashin<<endl;
cout<<"Change"<<(cashin-subtotal)<<endl;
cout<<"Thank you for visiting"'\n';
cout<<"Zandiago's Z-Burger Shack"<<endl;
}
Questions:
1. Considering the nature of the infile, how do i go above storing data into the three paralel arrays and what exactly will i be storing in the array from the infile?
2. I guess that once the data is in the array, then when i select a food type, it will automatically come up on the screen until the termination key (in this case '=') is pressed?
Any additional pointers are appreciated.