Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Exercise Objectives: reuse code segments previously written use the setw manipulator to align outputted results to format data appropriately use the set precision manipulator to

Exercise Objectives:

reuse code segments previously written

use the setw manipulator to align outputted results to format data appropriately

use the set precision manipulator to control the output of floating-point numbers

use accumulator variables to accumulate totals use incremental variables to increment a number.

For this exercise you will be repeating a task but will use the sequence structure. Later in the course you will learn the Loop Structure which will be much more efficient for repeating actions or tasks.

******Program Exercise:

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. Send all the output to the screen. Format the output so that it looks like the screen shot below. You need to put the Main Documentation Block (IPO) at the top of your program. And fill it in when you are done with your coding.

//----------------------------------------------------------------------------- //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!

image text in transcribed

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

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago