help with school looping question.

I have a project due for school and I'm having a tough time with the logic. I think I need a loop for the days and a loop for the rest of the stuff. Any help would be a godsend.
which the price of any unsold item drops 10 percent each day. Th e inventory fi le includes an item number, description, and original price on day one. For example, an item that costs $10.00 on the f i rst day costs 10 percent less, or $9.00, on the second day. On the third day, the same item is 10 percent less than $9.00, or $8.10. Design an application that reads inventory records and produces a report that shows the price of every item on each day, one through seven

Thanks again for any input.


maybe a do/while loop? You should try to attempt it and show some code.
Thanks for the resonse! I think a while loop is the way to go Im just not sure how to carry the discount from one day to the next. This mess is what I have so far.

start
Declerations
num itemnumber
num price
num discount = * .90
string
string itemdescription
string monday
string tuesday
string wendsday
string thursday
string friday
string saterday
string sunday
output "Enter Day"
input DAY
output "enter item number and price"
input itemnumber, price
while DAY = monday
while discount + price = monday
while DAY = tuesday
while discount + monday = tuesday
while DAY = wendsday
while discount + tuesday = wendsday
while DAY = thursday
while discount +thursday = friday
while DAY = friday
while discount + friday = saterday
while DAY = saterday
while discount + saterday = sunday
output itemnumber
o.O what is that
supposed to be suedocode but its turned into a monster mess. Im not sure how to get the discount to carry over from one day to the next.
I would think I could do a while Indefinite loop for the day and another inner while definite loop for the discount and other declarations but I have no idea how to carry the discount from one day to the next. So I ended up with some crazy idea's.
Last edited on
Start
declerations
num cost
num day = *.10
string = record_itemNumber
string description

file inventory file
while there are still records in the inventory file
input one record in inventory_File
cost =record, original_Price
string = record, original_Price
string = description
for(day2 = 1 to 7)
output record_itemNumber, description, cost
cost = cost *.9
endfor
endwhile
You should try to code it instead of just listing the things. And it seems like maybe a struct will be handy for the items.
Topic archived. No new replies allowed.