Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question

#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?

 

Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY