-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpos_code.c
More file actions
170 lines (150 loc) · 4.68 KB
/
Copy pathpos_code.c
File metadata and controls
170 lines (150 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <conio.h>
#pragma warning (disable:4996)
#define SST 0.10
#define MENUA 10.00
#define MENUB 15.00
#define MENUC 18.00
#define MENUD 24.00
void logo(void);
void order(void);
void daily(void);
//variables
int quanA, quanB, quanC, quanD; //temporary quantity counter(reset when finish loop)
int counterA = 0, counterB = 0, counterC = 0, counterD = 0;//total quantity
int tempA, tempB, tempC, tempD, counterAllcom;
int cusNum = 1, pay;
double comCharge, chargeSST, totalSale, sstTotal;
char orderIn, nextCus;
void main()
{
logo();
order();
system("pause");
}
void logo()
{
printf("\n");
printf(" _|_| _|_|_|_|_| _| \n");
printf(" _| _| _| _| \n");
printf(" _| _| _| _| \n");
printf(" _| _| _| _| _| \n");
printf(" _|_| _|_|_|_|_| _|_| \n");
printf(" WELCOME TO OZJ RESTAURANT!!!\n");
printf(" So Fast, so hot.\n\n");
printf(" \t\t\t\t\t\tDesign by Ooi Zhi Jie\n");
}
void order()
{
do
{
printf(" _______________\\ MENU /_______________\n");
printf(" COMBO A:\n" "\t2pc Fried Chicken + Coke + french fries.[RM10.00]\n");
printf(" COMBO B:\n" "\tChicken/Beer Burger + Coke + french fries.[RM15.00]\n");
printf(" COMBO C:\n" "\tDouble Cheese Burger + Coke + french fries.[RM18.00]\n");
printf(" COMBO D:\n" "\tSpaghetti with chicken chop + Coke + french fries.[RM24.00]\n");
printf("\n Customer Number :%d\n", cusNum);
do
{
rewind(stdin);
printf(" Please select a combo\n (Enter A, B, C, D /Enter other to finish ordering.)\t:");
scanf(" %c", &orderIn);
switch (orderIn)
{
case 'A':
case 'a':
printf(" Quantity :");
scanf("%d", &quanA);
printf(" COMBO A %d set(s):RM%.2f\n", quanA, (quanA * MENUA));
counterA = counterA + quanA;
comCharge = comCharge + (quanA * MENUA);
break;
case 'B':
case 'b':
printf(" Quantity :");
scanf("%d", &quanB);
printf(" COMBO B %d set(s),RM%.2f\n", quanB, (quanB * MENUB));
counterB = counterB + quanB;
comCharge = comCharge + (quanB * MENUB);
break;
case 'C':
case 'c':
printf(" Quantity :");
scanf("%d", &quanC);
printf(" COMBO C %d set(s),RM%.2f\n", quanC, quanC * MENUC);
counterC = counterC + quanC;
comCharge = comCharge + quanC * MENUC;
break;
case 'D':
case 'd':
printf(" Quantity :");
scanf("%d", &quanD);
printf(" COMBO D %d set(s),RM%.2f\n", quanD, quanD * MENUD);
counterD = counterD + quanD;
comCharge = comCharge + quanD * MENUD;
break;
default:
break;
}
} while (orderIn == 'A' || orderIn == 'B' || orderIn == 'C' || orderIn == 'D' || orderIn == 'a' || orderIn == 'b' || orderIn == 'c' || orderIn == 'd');
chargeSST = comCharge * SST;
printf(" =====================================\n"
"\tCombo Charges = RM%.2f\n"
"\tAdd SST(10%%) = RM%.2f\n"
"\tTOTAL TO PAY = RM%.2f\n", comCharge, chargeSST, comCharge + chargeSST);
do
{
printf("\n\tAmount Paid :RM");
scanf("%d", &pay);
if (pay >= (comCharge + chargeSST))
{
printf("\tChange Due = RM%.2f\n", pay - (comCharge + chargeSST));
}
else
{
printf("\n\tInvalid value entered, please enter the correct payment received.");
}
} while ((pay < (comCharge + chargeSST)));
printf("\n Thank you for choosing our restaurant!!\n");
printf(" Next Customer? Yes/No(Y/N) :");
rewind(stdin);
scanf("%c", &nextCus);
if (nextCus == 'Y' || nextCus == 'y')
{
++cusNum;
quanA = 0;
quanB = 0;
quanC = 0;
quanD = 0;
comCharge = 0;
}
else if (nextCus == 'N' || nextCus == 'n')
{
daily();
break;
}
} while (nextCus != 'N' || nextCus != 'n');
}
void daily()
{
printf(" ===============================================================\n"
" Daily Report \n"
" ===============================================================\n");
totalSale = (counterA * MENUA) + (counterB * MENUB) + (counterC * MENUC) + (counterD * MENUD);
sstTotal = totalSale * SST;
counterAllcom = counterA + counterB + counterC + counterD;
printf(" Total Number of Customers = %d\n\n"
" Combo Sales For Today = %d\n"
" Combo\t Quantity Sold\t Sales Amount\n"
" A\t %3d\t\t RM%.2f\n"
" B\t %3d\t\t RM%.2f\n"
" C\t %3d\t\t RM%.2f\n"
" D\t %3d\t\t RM%.2f\n"
" ======\t ====\t\t =========\n"
" TOTALS\t %3d\t\t RM %.2f\n", cusNum, counterAllcom, counterA, (counterA * MENUA), counterB, (counterB * MENUB), counterC, (counterC * MENUC), counterD, (counterD * MENUD), (counterA + counterB + counterC + counterD), totalSale);
printf(" TOTAL SST charges\t= RM %.2f \n", sstTotal);
printf(" TOTAL RM collected\t= RM %.2f \n", (totalSale + sstTotal));
}