CAN ANYONE PLEASE HELP ON THIS PROGRAM FOR MY EXAM..TQ

Write a C program to help a H’s Restaurant automate its
breakfast billing system. Your assignment should implement
the following items:

a. Show the customer the different breakfast items
offered by the H’s Restaurant.
b. Allow the customer to select more than one item
from the menu.
c. Calculate and print the bill to the customer.
d. Produce a report to present your complete program
and show more sample output.

Assume that the H’s Restaurant offers the following
breakfast menu:

Plain Egg $2.50
Bacon and Egg $3.45
Muffin $2.20
French Toast $2.95
Fruit Basket $3.45
Cereal $0.70
Coffee $1.50
Tea $1.80

Your program must do the following task below:

a. Define the data structs, menu item types with two
components: menu item of type string and menu price of type
double. Use an array to declare the data structs.
b. Function get data to loads the data into the array
menu list.
c. Function show menu to show the different breakfast
items offered by the restaurant and tell the user how to
select the items.
d. Function print receipt to calculates and prints the
customer receipt. The billing amount should include a 5%
tax.
e. Format your output with two decimal places. The
name of each item in the output must be left-justify. You
may assume that the user selects only one item of a
particular type.
f. The two sample output as shown:

Welcome to HiFi’s Restaurant
1 Bacon and Egg $3.45
1 Muffin $2.20
1 Coffee $1.50
Tax 5% $0.35
Amount Due $7.50

Answer Posted / ss

Week5


using namespace std;

enum Planet {MERCURY, VENUS, EARTH, MARS,JUPITER,
SATURN, URANUS,NEPTUNE,
PLUTO};

string tolowerstr(string str);
Planet StrToPlanet(string str);
string PlanetToStr(Planet planet);
void readData(double&, Planet&);
double PlanetWeight(double, Planet);




int main()
{//for (Planet p=MERCURY; p<=PLUTO; p=Planet(p+1))
//cout<<PlanetToStr(p)<<endl;
Planet planet;
double weight;
char answer;
do{

cout<<"Enter your weight? "; cin>>w;
cout<<"Enter a planet name? ";cin>>str;
cout<<"Your weight on ";
<<" is "<<PlanetWeight(weight,
planet)<<" kg."<<endl;

cout<<"Press letter s to stop? ";
cin>>answer;

}while (answer!='s' && answer!='S');

return 0;

}//main




Planet StrToPlanet(string str)
{//converts the string str value to its corresponding
Planets value
string cstr=tolowerstr(str); //converts user typed planet
name into lowercase form
if (cstr=="mars")
return MARS;
else if (cstr=="mercury")
return MERCURY;
else if (cstr=="venus")
return VENUS;
else if (cstr=="jupiter")
return JUPITER;
else if (cstr=="neptone")
return NEPTUNE;
else if (cstr=="saturn")
return SATURN;
else if (cstr=="pluto")
return PLUTO;
else
{
if (cstr!="earth")
cout<<"Invalid planet name.\n";
return EARTH;}}//ConvertToPlanets

string tolowerstr(string str)
{



//converts every character in the string str to lowercase
form
for(int i=0; i!=str.length(); i++)
str[i]=tolower(str[i]);

return str;





}







string PlanetToStr(Planet planet)
{
switch (planet)
{
case EARTH: return "Earth";
case JUPITER: return "Jupiter";
case VENUS: return "Venus";
case MARS: return "Mars";
case MERCURY: return "Mercury";
case SATURN: return "Saturn";
case NEPTUNE: return "Neptune";
case PLUTO: return "Pluto";
case URANUS: return "Uranus";
default: return "Error";

}//switch

}//PlanetToStr
double PlanetWeight(double earthweight, Planet p)
{
switch(p)
{
case JUPITER: return 2.5374*earthweight;
case VENUS: return earthweight* 0.8975;
case MARS: return earthweight*0.3507;
case MERCURY: return earthweight*0.4155;
case SATURN: return earthweight*1.0677;
case NEPTUNE: return earthweight*1.1794;
case PLUTO: return earthweight*0.0899;
case URANUS: return earthweight*0.8947;
default: return earthweight;
}//switch
}//PlanetWeight
void readData(double &w, Planet &p){
string str;
cout<<"Enter your weight? "; cin>>w;
cout<<"Enter a planet name? ";cin>>str;
p=StrToPlanet(str);
}

Is This Answer Correct ?    2 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

program for reversing a selected line word by word when multiple lines are given without using strrev

1951


What would be an example of a structure analogous to structure c?

578


What is the purpose of 'register' keyword?

694


How can you determine the maximum value that a numeric variable can hold?

643


Write a code to achieve inter processor communication (mutual exclusion implementation pseudo code)?

693






How to check whether string is a palindrome, WITHOUT USING STRING FUNCTIONS?

15513


Why is it usually a bad idea to use gets()? Suggest a workaround.

911


Does c have circular shift operators?

734


Which is the memory area not included in C program? give the reason

1510


What is the benefit of using #define to declare a constant?

610


Do you know the use of fflush() function?

605


How can a program be made to print the name of a source file where an error occurs?

735


Why we use stdio h in c?

586


How can you find the day of the week given the date?

621


What does typeof return in c?

640