Hi! I hope my post fits in Tech Board. If not, I'd be happy to move to to another location at cboard.
Could anyone please comment on my solution to the below mentioned problem? I feel so confused about using loop structures.(
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.20 (10% less than Monday) and so on. Develop a 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.
Here's what I've got (in pseudocode).
Read (Price)
Loop: Day = 1 TO 5
Price = Price*0,9
Counter = Counter + 1
LoopEnd: Day
Second part of the same problem goes like this: Make changes in the solution to problem 1 to set the price at wholesale when the sale price drops below the wholesale price.
Read (Price)
Loop: Day = 1 TO 5
Price = Price * 0,9
If Price < WholesalePrice
Price = WholesalePrice
Endif
LoopEnd: Day
Thank you very much in advance! And please, do post a line or two, even if this seems like child play to you. I can't move on with my studies if I don't understand loops properly and I've failed to do so on my own.