Share
Explore BrainMass

The Last Stop Boutique is having a five-day sale.

The Last Stop Boutique is having a five-day sale. Each day, starting on Monday, the price will drop 10% of the previous day's price. For example, if the original price of a product is $20.00, the sale price on Monday would be $18.00 (10% less than the original price). On Tuesday the sale price would be $16.0 (10% less than Monday). On Wednesday the sale price would be $14.58; on Thursday the sale price would be $13.12; and on Friday the sale price would be $11.81. Develop a C++ solution that will calculate the price of an item for each of the five days, given the original price. Test the solution for an item costing $10.00.

Solution Preview

Please have a look at the attached file, if things do not appear properly here. It is a plain text file, just that ".cpp" file extension is used to indicate that it is C++ code.

Note that if we do not increment the value of counter (used to count days) in the while-loop, loop condition will not change and as a result this while-loop will continue to run forever.

#include < iostream ...

Solution Summary

It is a fairly simple to understand program with brief comments. Solution gives two sample sessions with different costs of the item - 10$ and 20$.

$2.19