#include #include #include using namespace std; int calc_qty(int qty); void receipt( int qty, int qty2); int calc_qty(int qty); void coffee_size(int qty, int size, int choice, int qty2); void slices(); void beanounces(); int main() { int qty = 0, order = 0, size = 0, qty2 = 0; receipt (qty,qty2); calc_qty (qty); do { //displays the menu cout<<" Please select an item on the menu you would like to buy."<>choice; } switch (choice) { case 1: coffee_size(qty, size, order, qty2); break; case 2: slices(); break; case 3: beanounces(); break; case 4: cout<<"Enjoy your day"<>qty; price = 0.60; total = qty * price; cout << "You ordered " <>size; if(size == 1) { cout<<"The price for a 9oz cup is $1.50"<>qty; price=1.50; total = qty * price; cout<<"You ordered "<>qty2; price = 1.90; total = qty2*price; cout<<"You ordered "<>qty; price = .60; total = qty * price; cout<<" You ordered "<
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int calc_qty(int qty);
void receipt( int qty, int qty2);
int calc_qty(int qty);
void coffee_size(int qty, int size, int choice, int qty2);
void slices();
void beanounces();
int main()
{
int qty = 0,
order = 0,
size = 0,
qty2 = 0;
receipt (qty,qty2);
calc_qty (qty);
do
{
//displays the menu
cout<<" Please select an item on the menu you would like to buy."<<endl;
cout<<"Enter 1 for Coffee\n"<<"Enter 2 for cheese cake\n"<<"Enter 3 for coffee beens\n"<<endl;
cin>>choice;
}
switch (choice)
{
case 1:
coffee_size(qty, size, order, qty2);
break;
case 2:
slices();
break;
case 3:
beanounces();
break;
case 4:
cout<<"Enjoy your day"<<endl;
break;
default:
cout<<"invalid selection"<<endl;
}
} while (choice != 4)
return 0;
int calc_qty(int qty)
{
return qty;
}
void receipt(int qty, int qty2)
{
double price = 0.0;
cout<<"Coffee 9 oz"<<endl;
cout<<"Coffee 12 oz"<<endl;
cout<<"Cheese cake"<<endl;
cout<<"Coffee qty"<<calc_qty<<"Cheese cake qty: "<<calc_qty<<endl;
}
void slices()
{
double total, price;
int qty,
qty2=0;
cout<<fixed<<setprecision(2);
cout<<"How many slices do you want?\n";
cin>>qty;
price = 0.60;
total = qty * price;
cout << "You ordered " <<qty<<"ounces of coffee beans.\n"<<"Your total is "<<total<<endl;
receipt(qty, qty2);
}
void coffee_size(int qty,int size,int order,int qty2)
{
double total, price;
cout<<fixed <<setprecision(2);
cout<<"What size, press 1 for 9oz or press 2 for 12oz"<<endl;
cin>>size;
if(size == 1)
{
cout<<"The price for a 9oz cup is $1.50"<<endl;
cout<<"how many cups would you like?\n";
cin>>qty;
price=1.50;
total = qty * price;
cout<<"You ordered "<<qty <<" of the 9oz cups.\n"<<"Your total is "<<total<<endl;
}
else
{
cout<<"The Price for a 12 oz cup is $1.90\n";
cout<<"How many cups would you like?\n";
cin>>qty2;
price = 1.90;
total = qty2*price;
cout<<"You ordered "<<qty2<<"of the 12oz cups.\n"<<"Your total is "<<total<<endl;
}
}
void beanounces()
{
double total, price;
int qty;
cout<<fixed<<setprecision(2);
cout<<"how many ounces do you want?\n";
cin>>qty;
price = .60;
total = qty * price;
cout<<" You ordered "<<qty<<"ounces of coffee beans.\n"<<"Your total is:"<<total<<endl;
}
why is my code not working?
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images