Code:
const MenuData breakfast[NUMOFBREAKFASTITEMS] = {
{"Egg Breakfast", "Two eggs with a side of bacon and two slices of toast.", "", "2 Eggs, 2 Toats, 2 Bacons", "", 250.00},
{"Pancake Breakfast", "Three Buttermilk pancakes served with butter and syrup.", "", "Three Pancakes, Butter, Syrup", "", 200.00},
{"Meat Variety", "Three eggs and a full order of bacon and", "smoked sausages served with porridge, three fried dumplings and jam.", "1 Bowl Poridge,", "3 Fried Dumplings, Jam", 350.00}
};
const MenuData lunch[NUMBEROFLUNCHITEMS]= {
{"Cheese Burger", " Thick-sliced bacon and two slices of tastee", "cheese served with seared buns and fries.", "Cheese Burger, Fries", "", 450.00,},
{"Hotdog N' Fries", "Smoked sausages served between Hotdog Rolls with seasoned Fries.", "", "Smoked Sausage Hotdog, Seasoned Fries", "", 345.60,},
{"Chicken Feet Soup", "Chicken feet soup served with boiled dumplings", "yellow yam, sweet potato and 5 slices of garlic bread.", "Chicken soup- Boiled Dumplings, Yellow", "Yam, Sweet Potato, 5 Garlic Bread", 445.60}
};
const MenuData dinner [NUMBEROFDINNERITEMS]= {
{"Sunday Dinner", "Fried Chicken served with rice and peas and macaroni salad", "", "Fried Chicken, Rice and Peas, Macaroni Salad", "", 600.00,},
{"Pastas N' Such", "Macaroni casserole topped with an assortment of cheese","served with mashed potatoes and baked chicken", "Macaroni Casserole, Four Cheese Topping", "Mashed Potatoes, Baked Chicken", 450.00,},
{"Real Jamaican Dinner", "Ackee and saltfish served with boiled dumplings", "yam and irish potatoes", "Ackee and Saltfish, Boiled dumplings, Yam", "", 395.00,}
};
const MenuData dessert [NUMBEROFDESSERTITEMS]= {
{"Rock Cakes","", "", "Rock Cakes", "", 70.00,},
{"Gizzarda", "", "", "Gizzarda", "", 95.50,},
{"Fruit Cake", "", "", "Fruit Cake", "", 200.00,},
{"Apple Pie Slice", "", "", "Apple Pie Slice", "", 300.00,},
{"Cheese Cake Slice", "","", "Cheese Cake Slice", "", 300.00,},
{"Fudge Cupcake", "","", "Fudge Cupcake", "", 100.00,}
};
const MenuData beverage [NUMBEROFBEVERAGEITEMS]= {
{"Hot Chocolate", "", "", "Hot Chocolate", "", 60.00,},
{"Coffee", "", "", "Coffee", "", 50.00,},
{"Soft Drink", "", "", "Soft Drink", "", 90.00,},
{"Beer", "", "", "Beer", "", 150.00,},
{"Wine", "", "", "Wine", "", 250.00,},
{"Water", "", "", "Water", "", 75.00,}
};
void printReceipt (const MenuData menu[], int qty, info)
{
info in1;
int i;
enum options choices;
float subtot, subtotal;
float total, ctender, Tax;
float outstanding, balance;
for(i=0; i<qty; i++)
{
subtot= subtot + (menu[i].price*qty);
}
total= subtot* TAX;
Tax=total;
printf ("The Total is: %.2f\n");
printf ("Enter the cash tendered by customer: ");
scanf ("%f", &ctender);
if (ctender< total)
{
outstanding= total- ctender;
printf ("The customer has %.2f outstanding", outstanding);
printf ("Enter the outstanding balance: ");
scanf ("%f", &balance);
}
change= total- ctender;
printf ("The Chnage is: %.2f", change);
system ("cls");
printf ("To Print Receipt, "); system ("pause");
printf (" 8 \n");
printf (" 88 \n");
printf (" 88ooo. \n");
printf (" oo. .o. .oo oo d8b d8' `8b \n");
printf (" 88P'Y88'Y88 88' 88 88 \n");
printf ("o88o o88o d88b `YbodP' \n");
printf ( "\n");
printf (" ** RECIEPT** \n");
printf ("\n");
printf ("\n");
printf ("5 Kingston Road, Lot 5\n");
printf ("Cashier Name: %s", in1.Cname);
printf ("\n");
printf ("\n");
printf ("Item Bought QTY Price\n");
for(i=0; i<qty; i++)
{
printf ("%s \t%d \t$ %.2f\n", menu[i].name, qty, menu[i].price);
printf ("Subtotal $ %.2f\n", subtotal);
printf ("TAX $ %.2f\n", Tax);
printf ("Toatl Sale $ %.2f\n", total);
printf ("Cash Tendered $ %.2f\n", ctender);
printf ("\n");
}
}
What I'm trying to do is call the printReceipt function in the main, but I'm doing it wrong. Here is my attempt.