0% found this document useful (0 votes)
41 views2 pages

Restaurant Breakfast Menu Program

Uploaded by

eishalejaz0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views2 pages

Restaurant Breakfast Menu Program

Uploaded by

eishalejaz0
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

NAME : Eishal Ejaz

ROLL# : FA23/BSCS/606
SECTION : H
INSTRUCTOR : Sir Adeel Zafar
OBJECT ORIENTED PROGRAMMING LANGUAGE
Assignment # 1
#include <iostream> } else {

using namespace std; cout << "Enter quantity: ";

struct MenuItem { cin >> quantity;

string name; totalCost += menuItems[itemSelection - 1].price * quantity;

double price; }

}; cout << "Enter another item number (0 to exit): ";

int main() { cin >> itemSelection;

// Define the menu items }

MenuItem menuItems[] = { double tax = totalCost * 0.05;

{"Plain Egg", 1.45}, totalCost += tax;

{"Bacon and Egg", 2.45}, cout << endl << "=== Receipt ===" << endl;

{"Muffin", 0.99}, for (int i = 0; i < numItems; i++) {

{"French Toast", 1.99}, if (totalCost > 0 && menuItems[i].price == totalCost) {

{"Fruit Basket", 2.49}, cout << menuItems[i].name << " (x" << quantity << ")" << endl;

{"Cereal", 0.69}, }

{"Coffee", 0.50}, }

{"Tea", 0.75} cout << "Subtotal: $" << totalCost - tax << endl;

}; cout << "Tax (5%): $" << tax << endl;

cout << "Total: $" << totalCost << endl;

int numItems = sizeof(menuItems) / sizeof(menuItems[0]); cout << "Would you like another order? (y/n): ";

cout << "Welcome to the Restaurant Breakfast Menu!" << cin >> anotherOrder;
endl;
} while (anotherOrder == 'y' || anotherOrder == 'Y');
char anotherOrder = 'y';

do {
cout << "Thank you for visiting!" << endl;
double totalCost = 0.0;

for (int i = 0; i < numItems; i++) {


return 0;
cout << i + 1 << ". " << menuItems[i].name << " - $"
<< menuItems[i].price << endl; }

int itemSelection, quantity;

cout << "Enter item number (0 to exit): ";

cin >> itemSelection;

while (itemSelection > 0) {

if (itemSelection > numItems) {

cout << "Invalid item number. Please try again."


<< endl;

You might also like