-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdef.h
61 lines (58 loc) · 1.86 KB
/
def.h
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
//===============Functions Define=============
int generateBillID()
{
// Seed the random number generator with the current time
srand(time(NULL));
// Generate a random number between 1000 and 9999
int billID = rand() % 9000 + 1000;
return billID;
}
void BillGenerateHead(char name[50], char date[30], char time[30],int ID)
{
printf("\n");
printf("\n\t-----------------------------");
printf("\n\t Welcome to Hamza Restaurant ");
printf("\n\t-----------------------------");
printf("\n%s", time);
printf("\nBill ID: %d", ID);
printf("\nCustomer Name: %s", name);
printf("\n");
printf("----------------------------------------\n");
printf("Items\t\t");
printf("Qty\t\t");
printf("Total\t\t");
printf("\n----------------------------------------");
printf("\n\n");
}
void BillGenerateBody(char item[30], int qty, float price)
{
printf("%s\t\t", item);
printf("%d\t\t", qty);
printf("%.2f\t\t", qty * price);
printf("\n");
}
void BillGenerateFooter(float total)
{
printf("\n");
float discount = 0.1 * total;
float netTotal = total - discount;
float GST = 0.09 * netTotal;
float amountPayable = netTotal + GST;
printf("-------------------------------------------\n");
printf("\nSub Total \t\t\t%.2f", total);
printf("\nDiscount @10%s\t\t\t%.2f", "%", discount);
printf("\n\t\t\t -----------");
printf("\nNet Total \t\t\t%.2f", netTotal);
printf("\nGST @9%s \t\t\t%.2f", "%", GST);
printf("\n-------------------------------------------");
printf("\nAmount Payable \t\t\t%.2f", amountPayable);
printf("\n-------------------------------------------");
}
// Successful tone
void playSuccessTone() {
Beep(800, 200); // Frequency: 800Hz, Duration: 200ms
}
// Error tone
void playErrorTone() {
Beep(400, 500); // Frequency: 400Hz, Duration: 500ms
}