Simple Restaurant Point-of-Sale Application: Help?!
I've been having a lot of trouble with this one, any help would be great.
I basically have to create a point of sale application for tabulating a bill. The waiter/waitress has menu/drink/desert options that they can enter, as well as the ability to apply a discount and tip percentage, and then have the final bill tabulated.....
For the life of me I can't get it to work properly, I've been on this for nearly two days straight and I can't figure this out! :S
PS: I'm new to this language, please be gentle :P lol
EDIT: One of the big problems I'm having is in regards to a counter. Beside the items on the menu is a counter that shows how many of each item has been ordered, and must be updated in 'real time' as the order changes (same with subtotal, total)....I've gone through the notes I was provided and have followed it through, but it doesn't seem to make much sense..........my attempt is below lol
Code:
#include <stdio.h> // def's 4 printf,scanf,gets,puts,getchar,fflush
#include <conio.h> // def's 4 getch
#include <stdlib.h> // def's 4 system
#define GST 0.05
#define PST 0.08
#define i1 "ROAST PRIME RIB "
#define i1_p 12.45
#define i2 "HOT BBQ BEEF Sandwich"
#define i2_p 9.99
#define i3 "GRILLED CHEESE/FRIES "
#define i3_p 5.99
#define i4 "FILET MIGNON "
#define i4_p 21.99
#define i5 "CLUB HOUSE SANDWICH "
#define i5_p 10.99
#define i6 "B.L.T. SANDWICH "
#define i6_p 6.99
#define i7 "VEGETARIAN CHOW MEIN "
#define i7_p 8.95
#define i8 "ATLANTIC SALMON "
#define i8_p 16.45
#define i9 "CHEDDAR CHEESE BURGER"
#define i9_p 9.57
#define i10 "GRAIN FED VEAL "
#define i10_p 25.00
#define i11 "POP "
#define i11_p 1.65
#define i12 "Juice "
#define i12_p 2.49
#define i13 "Coffe "
#define i13_p 1.99
#define i14 "Shakes "
#define i14_p 2.85
#define i15 "APPLE PIE"
#define i15_p 3.55
#define i16 "Banana Sp"
#define i16_p 4.99
int main()
{
do
{
int a_counter, b_counter, c_counter, d_counter, e_counter, f_counter;
int g_counter, h_counter, i_counter, j_counter, k_counter, l_counter, m_counter;
int n_counter, o_counter, p_counter;
double total;
double discount, subtotal, tip, pst, gst;
double tippercent;
char choice;
a_counter=0;
b_counter=0;
c_counter=0;
d_counter=0;
e_counter=0;
f_counter=0;
g_counter=0;
h_counter=0;
i_counter=0;
j_counter=0;
k_counter=0;
l_counter=0;
m_counter=0;
n_counter=0;
o_counter=0;
p_counter=0;
subtotal=0;
discount=0;
gst=0;
tip=0;
pst=0;
total=0;
system ("cls");
printf("\n\t\t\t\tDAVE'S RESTAURANT");
printf("\n\nItem ENTREES\t\t\tPrices\t# Item\tDrinks\t Prices #");
printf("\n--------------------------------------------------------------------------------");
puts("");
printf(" A %s \t%.2f\t%i\tK\t%s\t %.2f %i",i1, i1_p, a_counter, i11, i11_p, k_counter);
printf("\n B %s \t%.2f\t%i\tL\t%s\t %.2f %i",i2, i2_p, b_counter, i12, i12_p, l_counter);
printf("\n C %s \t%.2f\t%i\tM\t%s\t %.2f %i",i3, i3_p, c_counter, i13, i13_p, m_counter);
printf("\n D %s \t\t%.2f\t%i",i4, i4_p, d_counter);
printf("\n E %s \t%.2f\t%i",i5, i5_p, e_counter);
printf("\n F %s \t%.2f\t%i\t\tDESSERTS",i6, i6_p, f_counter);
printf("\n G %s \t%.2f\t%i",i7, i7_p, g_counter);
printf("\n H %s \t%.2f\t%i\tN\t%s\t %.2f %i",i8, i8_p, h_counter, i14, i14_p, n_counter);
printf("\n I %s \t%.2f\t%i\tO\t%s %.2f %i",i9, i9_p, i_counter, i15, i15_p, o_counter);
printf("\n J %s \t\t%.2f\t%i\tP\t%s %.2f %i",i10, i10_p, j_counter, i16, i16_p, p_counter);
printf("\n");
printf("\n================================================================================");
printf("\n");
pst = subtotal * PST;
gst = subtotal * GST;
subtotal = i1_p+i2_p+i3_p+i4_p+i5_p+i6_p+i7_p+i8_p+i9_p+i10_p+i11_p+i12_p+i13_p+i14_p+i15_p+i16_p;
total = i1_p+i2_p+i3_p+i4_p+i5_p+i6_p+i7_p+i8_p+i9_p+i10_p+i11_p+i12_p+i13_p+i14_p+i15_p+i16_p+gst+pst+tip-discount;
printf("\n\t\t\t\t\t\tSubtotal = %.2f",subtotal);
printf("\n\t\t\t\t\t\tPST = %.2f",pst);
printf("\n\t\tSPECIAL DISCOUNT\t\t\tGST = ",gst);
printf("\n\t\t%.2f\t\t\t\tTIP = ",discount, tip);
printf("\n\t\t\t\t\t\tTOTAL = ",total);
printf("\n================================================================================");
printf("\nSELECT (A-P), R-RESET, - CORRECT, T-TIP, S-DISCOUNT, X-EXIT");
scanf("%c", &choice);
switch (choice)
{
case 'a':
case 'A':
a_counter++;
total = total + i1_p;
break;
case 'b':
case 'B':
b_counter++;
total = total + i2_p;
break;
case 'c':
case 'C':
c_counter++;
total = total + i3_p;
break;
case 'd':
case 'D':
d_counter++;
total = total + i4_p;
break;
case 'e':
case 'E':
e_counter++;
total = total + i5_p;
break;
case 'f':
case 'F':
f_counter++;
total = total + i6_p;
break;
case 'g':
case 'G':
g_counter++;
total = total + i7_p;
break;
case 'h':
case 'H':
h_counter++;
total = total + i8_p;
break;
case 'i':
case 'I':
i_counter++;
total = total + i9_p;
break;
case 'j':
case 'J':
j_counter++;
total = total + i10_p;
break;
case 'k':
case 'K':
k_counter++;
total = total + i11_p;
break;
case 'l':
case 'L':
l_counter++;
total = total + i12_p;
break;
case 'm':
case 'M':
m_counter++;
total = total + i13_p;
break;
case 'n':
case 'N':
n_counter++;
total = total + i14_p;
break;
case 'o':
case 'O':
o_counter++;
total = total + i15_p;
break;
case 'p':
case 'P':
p_counter++;
total = total + i16_p;
break;
case 't':
case 'T':
p_counter++;
printf ("ENTER TIP PERCENTAGE ");
scanf ("%f", &tippercent);
tip = ((subtotal)*(tippercent))/100;
break;
case 'x':
case 'X':
printf ("Press any Key to Exit");
getch();
break;
default:
printf("INVALID CHOICE!\a\a");
}
}
while (1);
return 0;
}