Question: You are going to create a shopping cart using C++ program. First, the program will ask users information (name, address, phone number). Then, display the

You are going to create a shopping cart using C++ program. First, the program will ask users information (name, address, phone number).

Then, display the items menu:

1. Orange $1.00 each

2. Banana $0.40 each

3. Tomato $3.00 each

4. Grape $2.50 each.

5. Pear $1.50 each

6. Lemon $0.50 each

The program will let the user purchase different item with different quantities each time using loops (you can use any loop). Then, the program calculates the sub-total of each item (subtotal before tax, tax, and sub-total after tax), assume tax is 8.25%. At the end, print a receipt include users information, purchase items and sub-totals, and finally, the total price before tax, total tax, and total price after tax.

Help please this is as far as i've gone.. need help with the loop and the finishing part of the reciept ********************************

#include

#include

#include // <--- For std::toupper() and tolower().

#include

using namespace std;

int main()

{

constexpr double TOMATOS = 1.0;

constexpr double BANANAS = 0.40;

constexpr double ORANGES = 3.0;

constexpr double PEARS = 0.25;

constexpr double GRAPES = 2.5 ;

constexpr double LEMONS = 0.5 ;

char checkout;

char choice;

int A{}, B{}, O{}, P{}, X{}, G{}, L{}, T{};

//int a{}, b{}, o{}, p{};

double qty{};

double subTotal{};

double total{};

std::string name;

std::string phone;

std::string address;

std::cout << "Please enter Name: ";

std::cin >> name;

std::cout << "Phone Number: ";

std::cin >> phone;

std::cout << "Address: ";

std::cin >> address;

//Check in

// Missing grapes and lemons and exit.

std::cout << " What would you like to Purchase " << std::endl;

std::cout << " 1. [O]ranges $1 each " << std::endl;

std::cout << " 2. [B]ananas $0.40 each " << std::endl;

std::cout << " 3. [T]omatos $3 each " << std::endl;

std::cout << " 3. [G]rapes $2.50 each " << std::endl;

std::cout << " 4. [P]ears $1.50 each " << std::endl;

std::cout << " 3. [L]Lemons $0.50 each " << std::endl;

std::cout << " 5. [X]Check out " << std::endl;

std::cin >> choice;

if (std::toupper(choice) == 'O')

{

std::cout << " How many would you like to buy? " << std::endl;

std::cin >> qty;

subTotal += ORANGES * qty;

}

else if (std::toupper(choice) == 'B')

{

std::cout << "How many would you like to buy? " <

std::cin >> qty;

subTotal += BANANAS * qty;

}

else if (std::toupper(choice) == 'T')

{

std::cout << " How many would you like to buy? " <

std::cin >> qty;

subTotal += TOMATOS * qty;

}

else if (std::toupper(choice) == 'G')

{

std::cout << " How many would you like to buy? " <

std::cin >> qty;

subTotal += GRAPES * qty;

}

else if (std::toupper(choice) == 'P')

{

std::cout << " How many would you like to buy? " <

std::cin >> qty;

subTotal += PEARS * qty;

}

else if (std::toupper(choice) == 'L')

{

std::cout << " How many would you like to buy? " <

std::cin >> qty;

subTotal += LEMONS * qty;

}

else if (std::toupper(choice) == 'X')

{

std::cout << " Your Total is..." <

std::cin >>checkout;

total = O+B+T+G+P+L;

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!