



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




mealName = "Chicken Manchurian with Egg Fried Rice"; mealPrice = 900; } else if (code == 3) { mealName = "Chicken Biryani"; mealPrice = 350; } else if (code == 4) { mealName = "Seekh Kabab (6pcs/plate)"; mealPrice = 700; } else if (code == 5) { mealName = "Chicken Jalfrezi"; mealPrice = 850; } else { cout << "Item is not on the menu." << endl; } cout << endl; int quantity;//user will enter the quantity and it must be more then 0 while (true) { cout << "Enter quantity to order: "; cin >> quantity; if (quantity <= 0) { cout << "Quantity must be greater than 0. Please enter again!" << endl; } else { break; } } cout << endl; // Calculate the total price for the current order totalMealPrice += mealPrice * quantity; orderCount++; //this will ask the user if he wants to order more items string moreItems; cout << "Do you want to order more items? (yes/no): "; cin >> moreItems; if (moreItems != "yes") { break; } } cout << endl; //this will calculate sales tax double salesTax; if (totalMealPrice <= 1000) { salesTax = 0; } else if (totalMealPrice <= 3000) { salesTax = totalMealPrice * 0.03; } else {
salesTax = totalMealPrice * 0.07; } // Calculate total amount double totalAmount = totalMealPrice + salesTax; //using manipulators for invoice cout << endl; cout << setw(25) << "Invoice" << endl; cout << "----------------------------------------------" << endl; cout << setw(5) << "Code" << setw(5) << "|" << setw(5) << "Price(PKR)" << setw(5) << "|" << setw(5) << "Quantity" << setw(5) << "|" << endl; cout << "================================================" << endl; cout << "Meal Price: " << setw(10) << totalMealPrice << " Rs." << endl; cout << "Sales Tax: " << fixed << setprecision(0) << setw(10) << (salesTax * 100 / totalMealPrice) << "%" << endl; cout << "Total Price: " << fixed << setprecision(0) << setw(10) << totalAmount << " Rs." << endl; system("pause"); return 0; }