0% found this document useful (0 votes)
74 views5 pages

Order Management System

The document describes an order management system console application that allows users to select meals from a menu, view order details, and calculate the total cost. The application displays a menu for users to choose from, tracks selected orders and prices, and calculates a total at the end.

Uploaded by

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

Order Management System

The document describes an order management system console application that allows users to select meals from a menu, view order details, and calculate the total cost. The application displays a menu for users to choose from, tracks selected orders and prices, and calculates a total at the end.

Uploaded by

Arceus Gonzales
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

ORDER MANAGEMENT SYSTEM

Overview

The Order Management System is a basic C++ console application that lets users
select meals from a menu, see the specifics of their orders, and figure out the total cost.

Features

1. Menu Display:
- The application shows a menu with selections for various meal orders.
- The price, description, and unique code are all included with each menu
item.
2. Order Selection:
- Users can choose an order by entering the corresponding number.
- The program validates user input and handles invalid selections gracefully.

3. Order Details:
- After selecting an order, the program displays the chosen order's code,
price, and description.
- Descriptions are hidden when choosing an order and revealed after the
order is made.

4. Order Tracking:
- The program tracks selected orders and their prices using vectors.

5. Total Price Calculation:


- After stopping the order process, the program calculates and displays the
total price of all selected orders.

6. User Interaction:
- The program continuously prompts the user for orders until they choose to
stop.

Data Structures

- Three vectors (`orders`, `prices`, and `descriptions`) store information


about menu items.
- Two additional vectors (`selectedOrders` and `selectedPrices`) track the
user's selected orders.
Main Loop

1. Display menu options and prompt the user to choose an order until they decide
to stop (entering 0).
2. For each valid order selection:
- Add the selected order's code and price to the tracking vectors.
- Display the chosen order's details, including the description.

3. After the user stops ordering:


- Calculate the total price of all selected orders.
- Display a summary of selected orders and the total price.

How to Use

1. Run the program.


2. Choose an order by entering the corresponding number.
3. Continue selecting orders or enter 0 to stop.
4. After stopping, view the selected orders and the total price.
The Code:

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main()
{
// Initialize vectors to store menu information
vector<string> orders;
vector<double> prices;
vector<string> descriptions;

// Populate menu items


orders.push_back("C1");
prices.push_back(109.00);
descriptions.push_back("Chicken, Rice and Drinks");

orders.push_back("C2");
prices.push_back(139.00);
descriptions.push_back("Chicken, Spaghetti and Drinks");

orders.push_back("C3");
prices.push_back(189.00);
descriptions.push_back("2 Pcs Chicken, Rice and Drinks");

orders.push_back("C4");
prices.push_back(209.00);
descriptions.push_back("2 Pcs Chicken, Rice, Fries and Drinks");

// Display menu options and take user orders


cout << "Choose an order from the following options or enter 0 to stop:\n";

vector<string> selectedOrders;
vector<double> selectedPrices;

int option;
do
{
// Display menu options
for (int i = 0; i < orders.size(); i++)
{
cout << i + 1 << ". " << orders[i] << "\n";
}
// Take user input for order choice
cout << "Enter the number corresponding to your choice (0 to stop): ";
cin >> option;

// Process user choice


if (option >= 1 && option <= orders.size())
{
// Add selected order and price to vectors
selectedOrders.push_back(orders[option - 1]);
selectedPrices.push_back(prices[option - 1]);

// Display chosen order details


cout << "You chose: " << orders[option - 1] << " - Price: Php " << prices[option -
1] << "\n";
cout << "Description: " << descriptions[option - 1] << "\n";
}
else if (option != 0)
{
// Display error message for invalid choice
cout << "Invalid choice. Please enter a number between 1 and " << orders.size()
<< " or 0 to stop.\n";
}

} while (option != 0);

// Calculate and display total price after stopping the order


double totalPrice = 0.0;
cout << "Selected Orders:\n";
for (int i = 0; i < selectedOrders.size(); i++)
{
cout << selectedOrders[i] << " - Price: Php " << selectedPrices[i] << "\n";
totalPrice += selectedPrices[i];
}

cout << "Total Price: Php " << totalPrice << "\n";
cout << "Ordering stopped. Thank you!\n";

return 0;
}

You might also like