
#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 nowThis is a popular solution!
Step by stepSolved in 2 steps with 2 images

- #include <bits/stdc++.h> using namespace std; struct Employee { string firstName; string lastName; int numOfHours; float hourlyRate; char major[2]; float amount; Employee* next; }; void printRecord(Employee* e) { cout << left << setw(10) << e->lastName << setw(10) << e->firstName << setw(12) << e->numOfHours << setw(12) << e->hourlyRate << setw(10) << e->amount << setw(9) << e->major[0]<< setw(7) << e->major[1]<<endl; } void appendNode(Employee*& head, Employee* newNode) { if (head == nullptr) { head = newNode; } else { Employee* current = head; while (current->next != nullptr) { current = current->next; } current->next = newNode; } } void displayLinkedList(Employee* head) { Employee* current = head; if(current!=nullptr){ cout…arrow_forwardvoid fun(int i) { do { if (i % 2 != 0) cout =1); cout << endl; } int main() { int i = 1; while (i <= 8) { fun(i); it; } cout <arrow_forward#include <bits/stdc++.h> using namespace std; struct Employee { string firstName; string lastName; int numOfHours; float hourlyRate; char major[2]; float amount; Employee* next; }; void printRecord(Employee* e) { cout << left << setw(10) << e->lastName << setw(10) << e->firstName << setw(12) << e->numOfHours << setw(12) << e->hourlyRate << setw(10) << e->amount << setw(9) << e->major[0]<< setw(7) << e->major[1]<<endl; } void appendNode(Employee*& head, Employee* newNode) { if (head == nullptr) { head = newNode; } else { Employee* current = head; while (current->next != nullptr) { current = current->next; } current->next = newNode; } } void displayLinkedList(Employee* head) { Employee* current = head; if(current!=nullptr){ cout…arrow_forward
- #include <iostream> #include <iomanip> #include <string> #include <vector> using namespace std; class Movie { private: string title = ""; int year = 0; public: void set_title(string title_param); string get_title() const; // "const" safeguards class variable changes within function string get_title_upper() const; void set_year(int year_param); int get_year() const; }; // NOTICE: Class declaration ends with semicolon! void Movie::set_title(string title_param) { title = title_param; } string Movie::get_title() const { return title; } string Movie::get_title_upper() const { string title_upper; for (char c : title) { title_upper.push_back(toupper(c)); } return title_upper; } void Movie::set_year(int year_param) { year = year_param; } int Movie::get_year() const { return year; } int main() { cout << "The Movie List program\n\n"…arrow_forward#include <iostream>#include <cstdlib>#include <time.h>#include <chrono> using namespace std::chrono;using namespace std; void randomVector(int vector[], int size){ for (int i = 0; i < size; i++) { //ToDo: Add Comment vector[i] = rand() % 100; }} int main(){ unsigned long size = 100000000; srand(time(0)); int *v1, *v2, *v3; //ToDo: Add Comment auto start = high_resolution_clock::now(); //ToDo: Add Comment v1 = (int *) malloc(size * sizeof(int *)); v2 = (int *) malloc(size * sizeof(int *)); v3 = (int *) malloc(size * sizeof(int *)); randomVector(v1, size); randomVector(v2, size); //ToDo: Add Comment for (int i = 0; i < size; i++) { v3[i] = v1[i] + v2[i]; } auto stop = high_resolution_clock::now(); //ToDo: Add Comment auto duration = duration_cast<microseconds>(stop - start); cout << "Time taken by function: " << duration.count()…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY





