You are to write a C++ Program to calculate an online purchase you would make. You may enter any data that like. 1. Read in the following data: • Your first and last name (string data) • Your street address (string data) • Your city, state and zip (string data) • The item name of the item you wish to purchase (string data) • The cost of the item you are purchasing (double data) • The quantity of that item you are purchasing (integer data) 2. Calculate the following: • Total of the purchase (cost times the quantity purchased) • The tax (the total times 7%) • The shipping (the total times 1%) • The final amount due (total + tax + shipping) 3. Print an invoice An example of what has to print is the following: Ship to: Joe Smith 101 Third Street Pittsburgh, PA 15211 Item: xxxxxxx Item price: xxxxxxx Quantity: xxxxxxx Total: xxxxxxx Tax: xxxxxxx Shipping: xxxxxxx Total Due: xxxxxxx Copy the source code and a screen shot of the program running to a word document. Upload the word document to blackboard Please note that you are NOT to format your output with specific decimal places. Just let the computer print whatever is stored.
Added by Michael W.
Close
Step 1
We will need to declare variables to store the user input for each data item. ```cpp #include <iostream> #include <string> int main() { std::string firstName, lastName, address, cityStateZip, itemName; double itemCost; int quantity; // Read in Show more…
Show all steps
Your feedback will help us improve your experience
Harriet O'Brien and 91 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Supreeta N.
Write a program that will be used as an app to help users compute the tax and tip on a restaurant bill. The program should first ask the user to enter the charge for the meal. The program should then prompt the user whether the meal is in-restaurant "restaurant" or whether it will be carry-out "carry-out." If a meal is in-restaurant, it is taxable and should be taxed. The California tax rate is 7.25 percent, so you will need to add that much of the meal charge if the meal is in-restaurant. The program should then prompt the user on whether the service was excellent ("Excellent"), good ("Good"), or typical ("Typical"). The tip should then be 30 percent if the service was excellent, 20% if it was good, or 15% if it was typical. Note that the tip is computed based on the subtotal (before tax if applicable). Display the meal charge, the type of order (in-restaurant or carry-out), tax amount if applicable, tip amount, and total bill on the screen. Example input: "restaurant" and "Good" Example output: In-Restaurant Meal Subtotal: $38.55 Tax: $2.79 Tip: $7.71 Total: $49.05
Shelayah R.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD