Help PLEASE!!!

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators:Administrator, Global Moderator

Post Reply
Guest
Help PLEASE!!!

Post by Guest » Wed Dec 11, 2002 8:26 am

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! ;)

vbmike56
Newbie
Posts:5
Joined:Sat Nov 30, 2002 7:51 am

Re: Help PLEASE!!!

Post by vbmike56 » Thu Dec 12, 2002 1:53 am

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
&nbsp; &nbsp;LET y = FIX((balance) / denomination(i))
&nbsp; &nbsp;PRINT y; "X";
&nbsp; &nbsp;ext = y * denomination(i)
&nbsp; &nbsp;PRINT USING "$####.##"; denomination(i)
&nbsp; &nbsp;LET balance = balance - ext
NEXT i
END IF

:-*

Post Reply