Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A second-hand store is having a seven day sale during which the price of any uns

ID: 3917404 • Letter: A

Question

A second-hand store is having a seven day sale during which the price of any unsold item drops 10 percent each day. They need a list of prices starting from day 1 (original price) to day 7 showing the discounted prices for each piece of inventory. The inventory file includes a record for each item that has an item number, description, and original price on day one. For example, an item that costs $10.00 on the first days costs 10 percent less, or $9.00, or $8.10. Write an algorithm that will obtain a piece of inventory from the inventory file and display the price of the item on each day, one through seven. Repeat for each piece of inventory in the file.

Explanation / Answer

pseudocode

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

output: list of prices starting from day 1 to day 7 showing the discounted prices for each piece of inventory

// variables are  item_number, description, price, day

open "inventory.txt" file

while not EOF

Read item_number, description, price

day = 1

while day <= 7

Write day, price

price = price * 0.9

day = day + 1

end while

go to next line

end while

close "inventory.txt" file

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

EOF means End of File

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote