Question
Sales and Format Overview For this daily, write a program that will calculate and display the cost of a specific number of items. The program
Sales and Format Overview For this daily, write a program that will calculate and display the cost of a specific number of items. The program should ask the user for the price of a single item (float or double) and the number of items that were purchased (integer). After getting the values from the user, the program should calculate the total cost of the purchase and display the following: The number of items that were purchased The price of a single item The total cost of the purchase The output that is displayed should follow this exact format: [_count] items at $_price each will cost $(cost) where the [_count] is the number of items that were purchased, _price is the price of a single item, and (cost) is the total cost of the purchase. The [_count] should occupy five (5) spaces and be right-aligned. The _price and (cost) should both display with leading dollar signs and exactly two digits to the right of the decimal point. Print a newline at the beginning and end of the formatted output. File You Must Submit Place the program code in a source file named sales_format.cpp Output (for 2 runs of the program) What is the price for a single item? 1.15 How many items were purchased? 4 4 items at $1.15 each will cost $4.60 What is the price for a single item? 11.00 How many items were purchased? 11444 11444 items at $11.00 each will cost $125884.00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started