Question

Write in c++ Your friend Michael runs a catering company. Some of the ingredients that his recipes required are measured in cups. When he goes to the grocery store to buy those ingredients, however, t...

Write in c++

Your friend Michael runs a catering company. Some of the ingredients that his recipes required are measured in cups. When he goes to the grocery store to buy those ingredients, however, they are sold only by fluid ounce. He has asked you to write a simple program that converts cups to fluid ounces. 1 Cup = 8 ounces

You should have the following functions:

  • showIntro – This function will display a message on the screen that explains what the program does
  • getCups
  • cupsToOunces
  • displayResult
1 0
Add a comment Improve this question Transcribed image text
✔ Recommended Answer
Answer #1

Solution:

I have written the c++ code and commented out each step. If you still have any doubt or need modification of the code, feel free to comment it, I'll get back to you ASAP.

Code:

#include<iostream>
using namespace std;

//Function declaration
void showIntro();
int getCups();
int cupsToOunces(int cups);
void displayResult(int fluidOunces);

//Main Function
main()
{
int cups; //To store number of cups
int fluidOunces;
showIntro(); //Printing intro of the store
//Taking the input in number of cups
cups = getCups();
//convert the given cups into fluid ounces
fluidOunces = cupsToOunces(cups);
//Displaying the result in fluid ounces
displayResult(fluidOunces);
}

//Function definition
//This function gives introduction about the grocery store
void showIntro()
{
cout<<"*** Welcome to Stark's grocery store ***"<<endl;
cout<<"*** Please input your order ***"<<endl;
cout<<"Enter the order in cups:";
}

int getCups()
{
int cups;
cout<<"Enter the order in cups:";
cin>>cups; //Taking the order in number of cups
return cups; //returning the number of cups for conversion
}

int cupsToOunces(int cups)
{
return cups*8; //since 1 cup = 8 fluid ounces
}

void displayResult(int fluidOunces)
{
//printing the result in fluid ounces
cout<<"The given order is "<<fluidOunces<<" Fluid ounces";
}

Results:

Welcome to Starks grocery store Please input your order Enter the order in cups: Enter the order in cups:15 ななな ななな ななな The

Add a comment
Know the answer?
Add Answer to:
Write in c++ Your friend Michael runs a catering company. Some of the ingredients that his recipes required are measured in cups. When he goes to the grocery store to buy those ingredients, however, t...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT