Too Tired? Too Anxious? Need More Time? We’ve got your back.
I have done some of the drink menu i just need some stuff fixed on it.
I will upload some images to see how the program needs to look when it is ran.
I will also upload the directions as an image as well.
i need this assigment done on Visual Studios with a C++ file attached.
Once it has ran it should look exactly like the examples i uploaded.
Below is my Program I just need it corrected
#include
#include
#include
#include
#include
using namespace std;
int main() {
const double BEVERAGE_PRICES[] = { 2.50, 2.50, 2.50, 2.00, 2.00, 1.75, 2.50, 2.50 };
const string BEVERAGE_NAMES[] = { “Pepsi”, “Mountain Dew”, “Dr. Pepper”, “Sunkist”, “Grapico”, “Ginger Ale”, “Sprite”, “Coke” };
string restaurant_name = “Garrett’s Cafe”;
int choice = 0;
double subtotal = 0.0;
double tip_percent = 0.0;
double tip_amount = 0.0;
double tax_rate = 0.08;
double tax_amount = 0.0;
double total = 0.0;
bool above_discount_threshold = false;
int table_number = rand() % 20 + 1;
do {
// Print beverage menu
cout << "Welcome to " << restaurant_name << endl;
cout << "Beverage Menu" << endl;
cout << "————-" << endl;
for (int i = 0; i < 8; i++) {
cout << i + 1 << ". " << setw(14) << left << BEVERAGE_NAMES[i] << "$" << fixed << setprecision(2) << BEVERAGE_PRICES[i] << endl;
}
// Print daily specials menu
cout << endl;
cout << "Daily Specials" << endl;
cout << "————–" << endl;
cout << "1. View specials" << endl;
cout << "2. Calculate bill" << endl;
cout << "3. Exit" << endl;
// Prompt user for choice
cout << endl;
cout <> choice;
switch (choice) {
case 1: {
string day_of_week;
cout << endl;
cout <> day_of_week;
if (day_of_week == “Monday”) {
cout << "Happy hour all day: $1.00 off any drink" << endl;
}
else if (day_of_week == "Wednesday") {
cout << "$1.00 off Coke Products" << endl;
}
else if (day_of_week == "Friday") {
cout << "Free refill on any drink" << endl;
}
else {
cout << "No specials today" << endl;
}
break;
}
case 2: {
// Reset subtotal and tip_amount
subtotal = 0.0;
tip_amount = 0.0;
// Prompt user for beverage choices
int num_beverages = 0;
int beverage_choice = 0;
do {
cout <> beverage_choice;
if (beverage_choice >= 1 && beverage_choice <= 8) {
subtotal += BEVERAGE_PRICES[beverage_choice – 1];
num_beverages++;
}
else if (beverage_choice != 0) {
cout << "Invalid choice. Please enter a number between 1 and 8, or 0 to finish." < 20.0) {
above_discount_threshold = true;
}
// Prompt user for tip percent
cout << endl;
cout <> tip_percent;
// Calculate tip amount
tip_amount = total * (tip_percent / 100.0);
// Apply discount if subtotal is above threshold
if (above_discount_threshold) {
cout << "Subtotal exceeds $20.00. 10% discount applied." << endl;
subtotal *= 0.9;
total = subtotal + tax_amount + tip_amount;
}
// Print receipt
cout << endl;
cout << "Garrett’s Cafe" << endl;
cout << "Table Number: " << table_number << endl;
cout << "———————–" << endl;
for (int i = 0; i < num_beverages; i++) {
cout << BEVERAGE_NAMES[i] << setw(18 – BEVERAGE_NAMES[i].size()) << right << "$" << fixed << setprecision(2) << BEVERAGE_PRICES[i] << endl;
}
cout << "———————–" << endl;
cout << "Subtotal" << setw(21) << right << "$" << fixed << setprecision(2) << subtotal << endl;
cout << "Tax" << setw(26) << right << "$" << fixed << setprecision(2) << tax_amount << endl;
cout << "Tip" << setw(26) << right << "$" << fixed << setprecision(2) << tip_amount << endl;
cout << "———————–" << endl;
cout << "Total" << setw(22) << right << "$" << fixed << setprecision(2) << total << endl;
cout << endl;
cout << "Thank you for dining in with us at Garretts Cafe!" << endl;
cout << "Your table number is " << table_number << endl;
cout << "You were served today by: Carson" << endl;
cout << "Come back to see us soon!" << endl;
break;
}
case 3: {
cout << "Exiting program…" << endl;
break;
}
default: {
cout << "Invalid choice. Please enter 1, 2, or 3." << endl;
break;
}
}
} while (choice != 3);
return 0;
}
Too Tired? Too Anxious? Need More Time? We’ve got your back.