Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using c++ can you help me write a code that has the following output. *Main-menu

ID: 3905013 • Letter: U

Question

Using c++ can you help me write a code that has the following output.

*Main-menu*
Press P to open Products sub-menu
Press C to open Customers sub-menu
Press O to open Orders sub-menu
Press E to exit from the Inventory Management System Please enter your input...

Based on the input of users as mentioned above, a sub-menu should open. If user enters P in the main-menu, it should open Products sub-menu:*Products sub-menu*

If user enters C in the main-menu, it should open Customers sub-menu:

If user enters O in the main-menu, it should open Orders sub-menu:

If user enters E in the main-menu, it should exit from the program.

For Products sub-menu:
If user presses A, it should the program.
If user presses V, it should If user presses D, it should If user presses B, it should

For Customers sub-menu: If user presses A, it should the program.
If user presses V, it should If user presses D, it should If user presses B, it should

For Orders sub-menu:
If user presses A, it should program.
If user presses V, it should If user presses D, it should If user presses B, it should

ask for input of the properties (of a product) and add the new product into

display all the list of products (with all the properties) in the program. delete all the list of products (with all the properties) in the program. show the main-menu to the users and ask for input accordingly.

ask for input of the properties (of a customer) and add the new customer into

display all the list of customers (with all the properties) in the program. delete all the list of customers (with all the properties) in the program. show the main-menu to the users and ask for input accordingly.

ask for input of the properties (of an order) and add the new order into the

display all the list of orders (with all the properties) in the program. delete all the list of orders (with all the properties) in the program. show the main-menu to the users and ask for input accordingly.

Note that the top-banner should be displayed only once in the program. Thanks

Explanation / Answer

here is your program : ------------->>>>>>>>>>>

#include<iostream>
#include<vector>
#include<string>
#include<cstdlib>

using namespace std;

typedef struct Product_{
string name;
double price;
int quantity;
}Product;

typedef struct Order_{
int orderNo;
double totalPrice;
}Order;

typedef struct Customer_{
string name;
string address;
int age;
}Customer;

vector<Product> products;
vector<Order> orders;
vector<Customer> customers;

void addProduct(){
Product p1;
cout<<" Enter Product Name ";
cin>>p1.name;
cout<<" Enter Product price ";
cin>>p1.price;
cout<<" Enter Product Quantity ";
cin>>p1.quantity;
products.push_back(p1);
}

void printProducts(){
cout<<endl<<"__________________PRODUCTS__________________ ";
for(int i = 0;i<products.size();i++){
  cout<<(i+1)<<" . Name : "<<products[i].name<<" Price : "<<products[i].price<<" Quantity : "<<products[i].quantity<<endl;
}
}

void deleteProduct(){
products.clear();
}

void addCustomer(){
Customer c1;
cout<<" Enter Name Of the Customer : ";
cin>>c1.name;
cout<<" Enter Address Of the Customer : ";
cin>>c1.address;
cout<<" Enter Age of the Customer : ";
cin>>c1.age;

customers.push_back(c1);
}

void deleteCustomer(){
customers.clear();
}

void printCustomer(){
cout<<endl<<"__________________CUSTOMERS___________________ ";
for(int i = 0;i<customers.size();i++){
  cout<<(i+1)<<" . "<<" Name : "<<customers[i].name<<" Age : "<<customers[i].age<<" Address : "<<customers[i].address<<endl;
}
}

void addOrder(){
Order o1;
cout<<" Enter Order Number : ";
cin>>o1.orderNo;
cout<<" Enter Toatl Price : ";
cin>>o1.totalPrice;

orders.push_back(o1);
}

void deleteOrder(){
orders.clear();
}

void printOrder(){
cout<<endl<<"________________ORDER______________ ";
for(int i= 0;i<orders.size();i++){
  cout<<(i+1)<<" . "<<" Order Number : "<<orders[i].orderNo<<" Price : "<<orders[i].totalPrice<<endl;
}
}

void main_menu(){
system("cls");
cout<<" Press P to open Products sub-menu"
  " Press C to open Customers sub-menu"
  " Press O to open Orders sub-menu"
  " Press E to exit from the Inventory Management System"
  " Please enter your input...";
}

void pro_menu(){
system("cls");
cout<<"Press A to add a Product Press V to view all Products Press D to delete all Products Press B to go back to main-menu"
  " Please enter your input...";
}

void cust_menu(){
system("cls");
cout<<"Press A to add a Customer"
" Press V to view all Customers"
" Press D to delete all Customers"
" Press B to go back to main-menu"
" Please enter your input...";
}

void ord_menu(){
system("cls");
cout<<"Press A to add an Order"
" Press V to view all Orders"
" Press D to delete all Orders"
" Press B to go back to main-menu"
" Please enter your input...";
}

int main(){
char ch1 = 'N';
char ch2 = 'N';

while(ch1 != 'E'){
  main_menu();
  cin>>ch1;
  ch1 = toupper(ch1);
  if(ch1 == 'P'){
   
   while(ch2 != 'B'){
    pro_menu();
    cin>>ch2;
    ch2 = toupper(ch2);
    if(ch2 == 'A'){
     addProduct();
    }else if(ch2 == 'V'){
     printProducts();
    }else if(ch2 == 'D'){
     deleteProduct();
    }else if(ch2 != 'B'){
     cout<<" WRONG CHOICE !!! ";
    }
    cin.get();
    cin.ignore();
   }
   ch2 = 'N';
  }else if (ch1 == 'C'){
   while(ch2 != 'B'){
    pro_menu();
    cin>>ch2;
    ch2 = toupper(ch2);
    if(ch2 == 'A'){
     addCustomer();
    }else if(ch2 == 'V'){
     printCustomer();
    }else if(ch2 == 'D'){
     deleteCustomer();
    }else if(ch2 != 'B'){
     cout<<" WRONG CHOICE !!! ";
    }
    cin.get();
    cin.ignore();
   }
   ch2 = 'N';
  }else if(ch1 == 'O'){
   while(ch2 != 'B'){
    pro_menu();
    cin>>ch2;
    ch2 = toupper(ch2);
    if(ch2 == 'A'){
     addOrder();
    }else if(ch2 == 'V'){
     printOrder();
    }else if(ch2 == 'D'){
     deleteOrder();
    }else if(ch2 != 'B'){
     cout<<" WRONG CHOICE !!! ";
    }
    cin.get();
    cin.ignore();
   }
   ch2 = 'N';
  }else if(ch1 != 'E'){
   cout<<" wrong choice !!! ";
  }
  cin.get();
  cin.ignore();
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote