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

In which header file is the null macro defined?

847


List some of the static data structures in C?

757


Mention four important string handling functions in c languages .

617


What are the advantages of c language?

660


Explain what will be the outcome of the following conditional statement if the value of variable s is 10?

738






Explain what are the different file extensions involved when programming in c?

629


which type of aspect you want from the student.

1697


Explain what does the format %10.2 mean when included in a printf statement?

769


What is new line escape sequence?

803


How do you print an address?

738


An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above

701


How do c compilers work?

602


7-Given an index k, return the kth row of the Pascal's triangle. For example, when k = 3, the row is [1,3,3,1]. For reference look at the following standard pascal’s triangle.

2215


what is the format specifier for printing a pointer value?

609


What is the purpose of realloc()?

663