Page 1 of 1
Help PLEASE!!!
Posted: Wed Dec 11, 2002 8:26 am
by Guest
Please, in my qbasic class in order for me to pass, i have to write a program that "will accept as INPUT",in other words i have to write a program that a user keys in the amount of money the total cost is, then how much money they paid, and then i have to have it print how many 10 dollar bills, 5 dollar bills, 1 dollar bills, quarters, dimes, nickels and pennies were recieved in return. thank you for this information. Any help is greatly appreciated!
Re: Help PLEASE!!!
Posted: Thu Dec 12, 2002 1:53 am
by vbmike56
Sorry If this is a little ratty, but is seems to work. Any bugs get back to me.
CLS
DIM denomination(1 TO 7) AS SINGLE
DIM balance AS SINGLE
DIM y AS INTEGER
DIM ext AS SINGLE
DATA 10,5,1,0.25,0.10,0.05,0.01
FOR i = 1 TO 7
READ denomination(i)
NEXT i
PRINT "How much is the item?"
INPUT price!
PRINT "Enter payment?"
INPUT payment!
LET balance! = payment! - price!
Dash$ = STRING$(10, 45)
PRINT Dash$; "Your Change"; Dash$
PRINT USING "$###.##"; balance!
FOR x = 1 TO 5
PRINT
NEXT x
IF balance! <> 0 THEN
FOR i = 1 TO 7
LET y = FIX((balance) / denomination(i))
PRINT y; "X";
ext = y * denomination(i)
PRINT USING "$####.##"; denomination(i)
LET balance = balance - ext
NEXT i
END IF
:-*