Question

In: Computer Science

Use linked list and write in C++ Food ordering system 1. Place Order 2. View the...

Use linked list and write in C++

Food ordering system

1. Place Order
2. View the food details
3. Modify food details
4. Delete food details

Order should let the customer to enter the food code, flavor, weight(kg), unit price, qty, customerID, name, address and contact number. It will also have an order id automatically assigned with a unique ID when new order is added. When view the food details, it should also calculate the unit price * qty as a bill amount. You should also be able to modify all the food details and delete food details.

Solutions

Expert Solution

// Online C++ compiler to run C++ program online
#include <iostream>
//#include <conio>
#include <iomanip>
#include<string.h>
using namespace std;

struct food{
int order_id;
//char food_code[10],flavor[20],customer_id[20];
//char address[100],name[50];
string food_code,flavor,customer_id;
string address,name;
int weight,unit_price,qty,contact_number;
struct food *next;
};
  

class Foodsystem{
food *head,*temp,*temp2,*end;
static int id;
  
public:
Foodsystem(){ head=NULL;end=NULL;}

void Place_Order();
void View_food_details();
void Modify_food_details();
void Delete_food_details();
};
  
int Foodsystem::id=1000;
  
void Foodsystem::Place_Order(){
temp=new food;
cout<<endl;
cout<<"enter your name ::";
//getline(cin,temp->name);
cin>>temp->name;
cout<<"enter contact number::";
cin>>temp->contact_number;
cout<<"enteer address::";
getline(cin,temp->address);
cout<<"customer_id::";
getline(cin,temp->customer_id);
cout<<"enter food code u want to order::";
getline(cin,temp->food_code);
cout<<"enter flavor you want";
getline(cin,temp->flavor);
cout<<"enter the food weight in kg";
cin>>temp->weight;
cout<<"enter unit price";
cin>>temp->unit_price;
cout<<"quanity of item you want::";
cin>>temp->qty;
temp->order_id=id++;
if(head==NULL)
{head=temp;end=head;}
else
{end->next=temp;end=temp;}

}
  
void Foodsystem::View_food_details()
{
temp=head;
while(temp){
cout<<"your order id::";
cout<<temp->order_id<<endl;
cout<<"customer_id::";
cout<<temp->customer_id<<endl;
cout<<"food code::";
cout<<temp->food_code<<endl;
cout<<"flavor";
cout<<temp->flavor<<endl;
cout<<"the food weight in kg";
cout<<temp->weight<<endl;
cout<<"unit price";
cout<<temp->unit_price<<endl;
cout<<"quanity of item ::";
cout<<temp->qty<<endl;
cout<<"bill amount";
cout<<temp->unit_price *temp->qty<<endl;
temp=temp->next;
}
}
  


int main() {
// Write C++ code here
Foodsystem fs;
int choice;
while(1)
{
cout<<endl<<"1. Place Order" <<endl<<"2. View the food details"<<endl<<"3. Modify food details"<<endl<<"4. Delete food details"<<endl<<"5. exit"<<endl;
cout<<"enter your choice";
cin>>choice;
switch(choice){
case 1 : fs.Place_Order(); break;
case 2 : fs.View_food_details();break;
// case 3 : fs.Modify_food_details();break;
// case 4 : fs.Delete_food_details();break;
case 5 : exit(0);
default : cout<<"wrong choice";
  
}
}

return 0;
}


Related Solutions

Use linked list and write in C++ Food ordering system 1. Place Order 2. View the...
Use linked list and write in C++ Food ordering system 1. Place Order 2. View the food details 3. Modify food details 4. Delete food details Order should let the customer to enter the food code, flavor, weight(kg), unit price, qty, customerID, name, address and contact number. It will also have an order id automatically assigned with a unique ID when new order is added. When view the food details, it should also calculate the unit price * qty as...
Use list/link list and write in C++ Food ordering system 1. Place Order 2. View the...
Use list/link list and write in C++ Food ordering system 1. Place Order 2. View the food details 3. Modify food details 4. Delete food details 5. Exit Order should let the customer to enter the food code, flavor, weight(kg), unit price, qty, customer ID, name, address and contact number. It will also have an order id automatically assigned with a unique ID when new order is added. When view the food details, it should also calculate the unit price...
Write in C++ code A system that allow users to place an order for the food,...
Write in C++ code A system that allow users to place an order for the food, view all the food details, modify or delete the food details. Design using objected oriented programming and list/link-list. Food order information contain : OrderID(auto assigned,unique), Food Code, flavor , weight, unit price, qty and customer information such as id, name, address and contact number. order ID shall be automatically assigned with a unique ID when new order is added. When viewing food details, it...
Please use C++ and linked list to solve this problem Linked list 1 -> 2 ->...
Please use C++ and linked list to solve this problem Linked list 1 -> 2 -> 3 -> 4 -> 5-> 6 ->7 replaceNode( 5 , 6) // Replace 5 with 6     result 1 -> 2 -> 3 -> 4 -> 6 -> 6 ->7 Base code #include <iostream> using namespace std; class Node { public:     int data;     Node *next;     Node(int da = 0, Node *p = NULL) {         this->data = da;         this->next =...
Please use C++ and linked list to solve this problem Linked list 1 -> 3 ->...
Please use C++ and linked list to solve this problem Linked list 1 -> 3 -> 4 -> 5-> 6 ->7 replaceNode( 5 , 6) // Replace 5 with 6     result 1 -> 3 -> 4 -> 6 -> 6 ->7 Base code #include <iostream> using namespace std; class Node { public:     int data;     Node *next;     Node(int da = 0, Node *p = NULL) {         this->data = da;         this->next = p;     } };...
1.Please write a C++ program that counts the nodes in a linked list with the first...
1.Please write a C++ program that counts the nodes in a linked list with the first node pointed to by first. Also please explain. 2. Write a program to determine the average of a linked list of real numbers with the first node pointed to by first. 3. Determine the computing times of the algorithms in question 1 and 4. Write a program to insert a new node into a linked list with the first node pointed to by first...
Q- Below is a project requirement for Online ordering system for fast food restaurant(where customer order...
Q- Below is a project requirement for Online ordering system for fast food restaurant(where customer order through app/online) Object-oriented design project: Table of Contents 1- Introduction; 2- Project Plan; 3- Functional Specifications (including descriptions of Actors/Roles; Business Rules; 3.1- Use-Case Diagrams with Use-Case descriptions; Examples of Class Diagrams (related to particular Use Cases); 3.2- Examples of Object Diagrams [related to the selected Class Diagrams]; 3.3- Examples of Sequence Diagrams; 3.4- Examples of Collaboration or Communication Diagrams; 3.5- Examples of State-Chart...
(Write a C# program DO NOT USE CLASS)Implement the merge sort algorithm using a linked list...
(Write a C# program DO NOT USE CLASS)Implement the merge sort algorithm using a linked list instead of arrays. You can use any kind of a linked structure, such as single, double, circular lists, stacks and/or queues. You can populate your list from an explicitly defined array in your program. HINT: You will not be using low, middle and high anymore. For finding the middle point, traverse through the linked list while keeping count of the number of nodes. Break...
C++, Write a routine that would receive a pointer to the top of the linked list...
C++, Write a routine that would receive a pointer to the top of the linked list that has an integer for each node. Count all positive even integers in the linked list but make negatives into positives. Return the count negatives that became positives. Hint, use Node<ItemType>* to define pointers and use pointers to go through the linked list.
C++ Write a routine that would receive a pointer to the top of the linked list...
C++ Write a routine that would receive a pointer to the top of the linked list that has a string for each node. Count all strings that start with a vowel (assume lowercase) in the linked list but tack on a “?” on all non-vowel strings. Return the count. Hint, use Node<ItemType>* to define pointers and use pointers to go through the linked list.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT