Monday, May 24, 2010

I would like help with a C+ programmed desinged to work like a fast food menu??

F'Zone offers three different types of burgers to hungry students in Fairmont. You have to write a small program in C++ to calculate the price of a burger order. Your program should display the following menu to the user and prompts for his/her choice:











1: Quarter pounder combo





2: Bacon burger





3: Swiss mushroom burger








· If the user enters 1, then the program should ask the user if he wants the “biggy” size and if he wants to add cheese. The combo costs $4.59; “biggy” size costs $.39 more, and cheese costs $.25 more.





· If the user enters 2, then the program should ask the user if he wants to add cheese and fries. The burger costs $3.49; fries costs $.59 more, and cheese costs $.25 more.





· If the user enters 3, then the program should ask the user if he wants to add onion rings and a coke. The burger costs $4.99; onions rings costs $.79 more, and coke costs $.75 more.





· If the user enters anything else, the program should display an error message and terminate.











For the YES/NO answers, the user should enter an upper case 'Y' or 'N'. All prices include tax. Finally, the total of the order should be calculated and displayed in dollars and cents. The input/output of the program should strictly follow the format shown in the sample executions.








For character input, you should use the getchar function. Following is an example of how you can use this:





char x;


x = getchar();

I would like help with a C+ programmed desinged to work like a fast food menu??
#include %26lt;iostream%26gt;


#include %26lt;iomanip%26gt;





using namespace std;





int main() {





  cout %26lt;%26lt; "Welcome to F\'Zone\n"


      %26lt;%26lt; "\n"


      %26lt;%26lt; "Please select from the following menu.\n"


      %26lt;%26lt; "\n"


      %26lt;%26lt; "1: Quarter pounder combo\n"


      %26lt;%26lt; "\n"


      %26lt;%26lt; "2: Bacon burger\n"


      %26lt;%26lt; "\n"


      %26lt;%26lt; "3: Swiss mushroom burger\n"


      %26lt;%26lt; "\n"


      %26lt;%26lt; "To place your order, enter the number of the meal you would like.\n"


      %26lt;%26lt; "For instance enter 2 for a Bacon Burger.\n"


      %26lt;%26lt; "\n"


      %26lt;%26lt; "Please enter your selection now: ";


  char x;


  x = getchar();


  double total = 0.0;


  switch (x) {


    case '1' :


      total = 4.59;


      cout %26lt;%26lt; "Would you like a \'biggy\' size? It costs $0.39 extra.\n"


          %26lt;%26lt; "Type in a 'Y' or a 'N': ";


      //x = getchar();


      cin %26gt;%26gt; x;


      if (x == 'Y') {


        total += 0.39;


        cout %26lt;%26lt; "You have chosen to have a \'biggy\' size.\n";


      }


      cout %26lt;%26lt; "Would you like cheese with that? It costs $0.25 extra.\n"


          %26lt;%26lt; "Type in a 'Y' or a 'N': ";


      //x = getchar();


      cin %26gt;%26gt; x;


      if (x == 'Y') {


        total += 0.25;


        cout %26lt;%26lt; "You have chosen to have cheese.\n";


      }


      break;


    case '2' :


      // similar to 1, just change the price and messages.


      break;


    case '3' :


      // similar to 1, just change the price and messages.


      break;


    default :


      cout %26lt;%26lt; "You have not ordered a menu item.";


      return 1;


  }


  cout %26lt;%26lt; "The total of your order is $" %26lt;%26lt; setiosflags(ios::fixed)


      %26lt;%26lt; setprecision(2) %26lt;%26lt; total %26lt;%26lt; resetiosflags(ios::fixed);


}
Reply:So basically you don't want help, that is to learn. You just want someone to do your assignment for you, so you learn nothing. Here is your program.





#include %26lt;iostream%26gt;


#include %26lt;string%26gt;





using namespace std;





int main()


{


string question;





question = "no sense";





if (question == "sense")


{


cout %26lt;%26lt; "You rox my lvl 27 sox!";


}


else


{


cout %26lt;%26lt; "You seriously suck at asking questions" %26lt;%26lt; endl;


cout %26lt;%26lt; "Try doing your own work, or at least thinking about it before you ask" %26lt;%26lt; endl;


cout %26lt;%26lt; "WTF PWNED!!!" %26lt;%26lt; endl;


}


return 0;


}
Reply:Which class is this from? I would be interested in taking it.





Please do your own homework. It will really pay off in the end.


No comments:

Post a Comment