Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Fix this code *****To make a profit, a local store marks up prices of items by a certain percentage. Write a C++ program that inputs

Fix this code

*****To make a profit, a local store marks up prices of items by a certain percentage. Write a C++ program that inputs the original price of an item 1 and original price of item 2 from the user. Assign a value of 50% for the markup percent and assign 8.5% for the sales tax rate. For each item, Calculate the markup amount, the tax, the selling price (before tax), and the final price (includes tax). You must use the same variable names for the first and second item

------------------------------------------------------------------------------------------------------------------------------------------

//Program: Exercise 2 //Grade: //Comments: //Description (IPO): // //Input: 2 original prices // //Process: Calculate markup amount, selling price, tax, and final price for each item, accumulate total tax and final cost // //Output: Assigned & calculated values, total tax, total final cost //------------------------------------------------------------

//Include - to use input & output on the screen #include

//Include - to use string variables #include

//Include - to use input & Output Manipulators #include

/amespace using statement must be included to use the standard header files using namespace std;

//Constants const string MY_PROGRAM = "Exercise 2"; const string MY_NAME = "TTC";

const double MARKUP_PERCENT = 0.50; const double SALES_TAX_RATE = 0.085;

const int SCREEN_WIDTH = 90; const char SYMBOL = '*';

int main(void) { int itemNumber;

double originalPrice; double markupAmount; double sellingPrice; double tax; double finalPrice; double totalSalesTax = 0; double totalFinalCost = 0;

//Initialize item number itemNumber = 0;

//Initialize accumulators totalSalesTax = 0.0; totalFinalCost = 0.0;

//Output the haeading to the screen cout

//Set all output of floating point numbers on the screen to fixed with precision of 3 cout

//--------------------------------------item 1------------------------------ //Input original prices from the user cout > originalPrice; cout

//Increment item number itemNumber++;

//Calculate for markupAmount, sellingPrice,tax, finalPrice

markupAmount = originalPrice * MARKUP_PERCENT; sellingPrice = originalPrice + markupAmount; tax = sellingPrice * SALES_TAX_RATE; finalPrice = sellingPrice + tax;

// Calculate the total sales tax and final cost totalSalesTax = tax; totalFinalCost = finalPrice;

//Output the data to the screen cout

//Output a divider to the screen cout

//--------------------------------------item 2------------------------------- cout > originalPrice; cout

//Increment item number itemNumber++;

//Calculate for markupAmount, sellingPrice,tax, finalPrice markupAmount = originalPrice * MARKUP_PERCENT; sellingPrice = originalPrice + markupAmount; tax = sellingPrice * SALES_TAX_RATE; finalPrice = sellingPrice + tax;

// Calculate the total sales tax and final cost totalSalesTax = tax; totalFinalCost = finalPrice;

//Output the data to the screen cout

//Output a divider to the screen cout

cout

return 0;

}

image text in transcribed

program requirements

//-----------------------------------------------------------------------------

//Programmer's Name:

//Program: Exercise 2 //

Description (IPO):

// Assign sales tax rate

// Assign markup percent

// Initialize the accumulators to 0 /

/ Initialize item number to 0

// For each item

// Input the original price from the keyboard

// Increment item number by 1

// Calculate the markup amount for this item

// Calculate the selling price for this item

// Calculate the sales tax for this item

// Calculate the final price for this item

// Accumulate this item's sales tax into the total tax

// Accumulate this item's final price into the final cost

// Output this item's assigned & calculated values to the screen

// Output total tax to the screen // Output total final cost to the screen

//-----------------------------------------------------------------------------

Program Requirements:

Use the course rules for blocking the code, constant names and variable names

increment item number for each item Use accumulators for the total sales tax and total final cost

set for floating point values appropriately to 2 or 3 as needed for the output

Output all data to the screen formatted using setw to align

Output a divider to the screen to separate items & totals using setw

Comment the code using the keywords

Do Not submit with any Warnings or Errors!

Enter the original price: 12.35 The markup percent: 0.50 The markup amount: 6.17 Thesalestaxrate:Thesellingprice:0.08518.52 Thetax:Thefinalprice:1.5720.10 Enter the original price: 17.50 Item Number: The original price: The markup percent: The markup amount: 8.75 The sales tax rate: 0.085 The selling price: 26.25 \begin{tabular}{lr} The tax: \\ The final price: & 2.23 \\ \hline \end{tabular} The total sales tax for both purchases is: The total final cost for both purchases is: 48.81 Press any key to continue

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

What is (are) the invoice number(s) of the duplicate payments?

Answered: 1 week ago