Question

In: Computer Science

Write the program in C++ The Rebel food truck has asked you to write a program...

Write the program in C++

The Rebel food truck has asked you to write a program for them to do both inventory and sales for their food wagon. Ben and Dave run the food truck and they already have full time day jobs so they could really use your help.

The food truck sells: hamburger, hotdogs, chilli, fries and soda. The truck has spots for 200 hamburger patties, 200 hot dogs, 75 hamburger buns, 75 hot dog buns, 500 ounces of chili, 75 fry baskets and 200 cans of soda.

Items sells for: Hamburger - $5, Hotdogs - $5, Chili (12 oz.) - $4, Fries (basket) - $7, Chili on burger, dog or fries (4 oz) - $2, Soda - $2. There is 5% tax in the area.

Create a menu driven program that they can run at the top of the night, put in current inventory and then sell items allowing them to enter sales for a customer on a repeating basis and get a result to charge them. Also take the items out of inventory when they are used. If an item goes to near zero and can no longer be sold then it should come off the menu.

Have something in the program that allows the user to terminate the program at the end of the night and it should signal to them if inventory for an item goes below 20%.

Solutions

Expert Solution

#include<iostream>
using namespace std;
int main()
{
    //inititalize the items
    string items[7]={"Hamburger Patties","Hamburger Buns","Hot Dogs","Hot Dog Buns","Chilli","Fry Baskets","Soda"};
    //initialize the quantity
   static int nos[7]={200,75,200,75,500,75,200};
   //initialize the price
    int price[7]={5,5,5,5,4,7,2};
    //initialize the twenty percentage of items
    int twentypercen[7]={40,15,40,15,100,15,40};
    int i,j,k,total=0,n;
    char opt;
    //infinite loop
    while(1)
{
  
   //display the items
       for(i=0;i<7;i++)
       {//check the status of items whether 0 or not, if 0 then discard it from menu
           if(nos[i]!=0)
           {
           if(items[i].length()>=12 ) //condition for formatting the output, i.e/ allow a single tab otherwise double tab
       cout<<endl<<i+1<<". "<<items[i]<<" \t "<<nos[i]<<" \t $"<<price[i];
       else
       cout<<endl<<i+1<<". "<<items[i]<<" \t\t "<<nos[i]<<" \t $"<<price[i];  
             
           }         
       }
       //ask about the choice
       cout<<endl<<"Enter your order";
       cin>>k;
       //condition for chillis
       if(k==5)
       {
           //ask for the purpose of chilli
           cout<<endl<<"Do you want chilli with burgor dog or fries(y/n)";
           cin>>opt;
          
           if(opt=='y' || opt=='Y')
           {
               top1:
               //ask for the quantity of chilli
           cout<<endl<<"Enter the quantity of "<<items[k-1];
           cin>>n;
           //the quantity must be multiple of 4
           if(n%4!=0)
           {
              cout<<endl<<items[k-1]<<"can be taken out multiple of 4";
              goto top1;
           }
           //compute the total
           total=total + 2*(n/4);
           //update the quantity
       nos[k-1]=nos[k-1]-n;
           }
           else
           {
              top:
              //ask the quantity
           cout<<endl<<"Enter the quantity of "<<items[k-1];
           cin>>n;
           if(n%12!=0) //it should be multiple of 12
           {
              cout<<endl<<items[k-1]<<"can be taken out multiple of 12";
              goto top;
           }
           //compute the total
           total=total + price[k-1]*(n/12);
           //update the quantity
       nos[k-1]=nos[k-1]-n;
           }
           }

//block for other items
           else
           {
              //ask for the quantity
              cout<<endl<<"Enter the quantity of "<<items[k-1];
               cin>>n;
               //compute the total
               total=total + price[k-1]*n;
               //update the quantity
       nos[k-1]=nos[k-1]-n;
           }
           //display the items below 20%
       for(i=0;i<7;i++)
       {
           if(nos[i]<twentypercen[i])
           cout<<endl<<items[i]<<" goes below 20%";
       }
       //ask user to continue or not
       cout<<endl<<"Do you want to continue(y/n)";
       cin>>opt;
       if(opt=='n'||opt=='N')
       break;
         
   }
   //display the total
   cout<<endl<<"Total Amount to pay : $"<<total;
}

output


Related Solutions

You are asked to write a simple C++ phonebook application program. Here are the requirements for...
You are asked to write a simple C++ phonebook application program. Here are the requirements for the application. read the contact information from a given input file (phonebook.txt) into a dynamically created array of Contact objects. Each line of the input line includes name and phone information of a contact. Assume that each name has a single part Allow to perform operations on array of data such as search for a person, create a new contact or delete an existing...
your friend has a food truck business and has asked your advice on using social media...
your friend has a food truck business and has asked your advice on using social media to promote his business. What direction would you offer? Thoroughly explain which social media tools(at least 3) he should use and how?
The driver’s license office DMV has asked you to write a program that grades the written...
The driver’s license office DMV has asked you to write a program that grades the written portion of the driver’s license questions. The questions has 20 multiple-choice questions. Here are the correct answers: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 B D A A A C B C D A D C C D D B A B C D Your program should store these correct answers...
Python Language: The Marietta Country Club has asked you to write a program to gather, then...
Python Language: The Marietta Country Club has asked you to write a program to gather, then display the results of the golf tournament played at the end of March. The Club president Mr. Martin has asked you to write two programs. The first program will input each player's first name, last name, handicap and golf score and then save these records in a file named golf.txt (each record will have a field for the first name, last name, handicap and...
Coding Problem 1: In this program, you are asked to write a program in assembly (MIPS)...
Coding Problem 1: In this program, you are asked to write a program in assembly (MIPS) which works as a simple calculator. The program will get two integer numbers, and based on the requested operation, the result should be shown to the user. a. The program should print a meaningful phrase for each input, and the result. i. “Enter the first number” ii. “Enter the second number” iii. “Enter the operation type” iv. “The result is” b. The user should...
(Write a program in C++) A local instructor wants you to write a program to calculate...
(Write a program in C++) A local instructor wants you to write a program to calculate the average score made on exams by her students. For simplicity, she always has only 12 students in each course she teaches. She teaches multiple subjects so she would like to enter the name of the exam. She wants the program to also determine the highest and lowest scores and the number of students who passed and failed the exam. A score of 60...
For Python: In this assignment you are asked to write a Python program to determine the...
For Python: In this assignment you are asked to write a Python program to determine the Academic Standing of a studentbased on their CGPA. The program should do the following: Prompt the user to enter his name. Prompt the user to enter his major. Prompt the user to enter grades for 3 subjects (A, B, C, D, F). Calculate the CGPA of the student. To calculate CGPA use the formula: CGPA = (quality points * credit hours) / credit hours...
Write and test a C program to implement Bubble Sort. . In your C program, you...
Write and test a C program to implement Bubble Sort. . In your C program, you should do: Implement the array use an integer pointer, get the size of the array from standard input and use the malloc function to allocate the required memory for it. Read the array elements from standard input. Print out the sorted array, and don’t forget to free the memory. Debug your program using Eclipse C/C++ CDT.
Write a C++ die roller program. We need you to write a program that will roll...
Write a C++ die roller program. We need you to write a program that will roll dice for them, but not just six-sided dice. Your program needs to be able to take an input in for form nDx or ndx where the d is the letter d or D. n may or not be present. If it is, it represents the number of dice. If not, assume it is a 1. x may or may not be present. If it...
You are asked to write a program to help a small company calculate the amount of...
You are asked to write a program to help a small company calculate the amount of money to pay their employees. In this simplistic world, the company has exactly three employees. However, the number of hours per employee may vary. The company will apply the same tax rate to every employee. Problem Description Inputs (entered by user of the program) • Name of first employee • Hourly rate • Number of hours worked • Name of second employee • Hourly...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT