Flow of Control with Loops Conditional Statements and Arrays Project
Description
C++ source file name: Shopping2.cpp
File name must be Shopping2.cpp
The goal of this assignment is to solve problems that involve flow of control with loops and conditional statements, and arrays. We would like to design an online menu-driven application that allows users to order one or more items from each category of Grocery products from the Panther Store.
There are three categories of Grocery products: Fruits, Vegetables and Beverages. The following lists each item within a category of Grocery products, along with its price.
Panther Fruits
- Fuji Apples (3 lb) $4.27
- Watermelon (each) $7.88
- Strawberries (16 oz) $2.42
Panther Vegetables
- Red Cabbage (each) $2.97
- Zucchini (each) $0.81
- Beets (1 lb) $2.44
Panther Beverages
- Apple Juice (64 fl oz) $2.88
- Orange Juice (64 fl oz) $5.54
- Coconut Water (33.8 fl oz) $3.47
Initially, the program will prompt the user for a total budget. If the user ever exceeds that budget while ordering Grocery items, an error message will display and the item will not be added to the order. That way the program will make sure that the user stays within budget.
The user may order more than one item from each category.
Panther Vegetables are shipped at a flat rate of $2 regardless of the number of items, Panther Beverages similarly are shipped at $5.50 and Panther Fruits at $3.50. Shipping costs are considered outside the user’s budget. The program will keep track of which products have been ordered, how many have been ordered, which category they have been ordered from, how much the user has spent, and the user’s balance.
After ordering is complete, the program will print out an overall invoice. No invoice prints if the customer orders nothing.
Your program’s output must match the output below as exactly as possible.
Sample Interaction: (user inputs are in bold blue fonts)
Welcome to Panther Grocery Store Please enter shopping budget ($): 20.00 ================================================================ Panther Fruits ---------------- 1 Fuji Apples (3 lb) ($4.27) 2 Watermelon (each) ($7.88) 3 Strawberries (16 oz) ($2.42) Please select your fruit (1-3, 0 to cancel): 2 Please enter quantity (0 to skip): 1 Added to shopping cart: Watermelon [1] ($7.88) Balance : $12.12
Continue shopping in this category? (Y/N): Y
Please select your fruit (1-3, 0 to cancel): 3
Please enter quantity (0 to skip): 2
Added to shopping cart: Strawberries [2] ($4.84)
Balance : $7.28
Continue shopping in this category? (Y/N): N
Panther Vegetables ------------------- 1 Red Cabbage (each) ($2.97) 2 Zucchini (each) ($0.81)
3 Beets (1 lb) ($2.44) Please select your vegetable (1-3, 0 to cancel): 3 Please enter quantity (0 to skip): 10 Order amount exceeds budget -- cannot proceed. Balance : $7.28
Continue shopping in this category? (Y/N): Y
Please select your vegetable (1-3, 0 to cancel): 2
Please enter quantity (0 to skip): 5
Added to shopping cart: Zucchini [5] ($4.05)
Balance : $3.23
Continue shopping in this category? (Y/N): N
Panther Beverages
----------------
1 Apple Juice (64 fl oz) ($2.88)
2 Orange Juice (64 fl oz) ($5.54)
3 Coconut Water (33.8 fl oz) ($3.47)
Please select your beverage (1-3, 0 to cancel): 0 Balance : $3.23
Continue shopping in this category? (Y/N): N
=================== Invoice - Panther Home ==================== Item Price Qty Amount --------------------------------------------------------------- 1 Watermelon 7.88 1 7.88
2 Strawberries 2.42 2 4.84
3 Zucchini 0.81 5 4.05 Shipping: 5.50 --------------------------------------------------------------- Total Amount: 22.27 --------------------------------------------------------------- Thank you for shopping at Panther Grocery Store!
printf formatting instructions:
- The “Item” column in the table has a width of 30 characters
- The “Price” column has a width of 10 characters
- The “Qty” column has a width of 10 characters
- The “Amount” column in the table has a width of 10 characters
- The item numbering column in the table has a width of 3 characters
For program style refer to Section 2.5 from book/slides and follow the style illustrated in the example programs from the book/slides/lab descriptions. A few important ones are – consistent indentation, aligning statements in a block, consistent placement of curly braces, indent statements in a block, meaningful variable names, no more than 95 characters per line, only one statement per line, etc.
Submissions will be screened for plagiarism and other academically dishonest practices so you MUST do entirely your own work. You may help each other to understand and mathematically grasp the problems, but all submitted work must be unique and original. Please submit your assignment by the due date to the Assignment 2 location in Canvas.
Include the following header at the top of your Shopping2.cpp file
/*
* Author: Firstname Lastname, email
* Course: CSE 1502, Section 04/05/S04 Spring 2022
* Project: Shopping2.cpp
*/
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."