contestada

Pp 2.10 write an application that determines the value of the coins in a jar and prints the total in dollars and cents. read integer values that represent the number of quarters, dimes, nickels, and pennies.

Respuesta :

AL2006

5 CLS : PRINT

10 PRINT "Hi !"  

15 PRINT "Please type the number of quarters, dimes, nickels, and pennies in the jar."

20 PRINT "Type commas between the numbers."

30 INPUT Q, D, N, P

40 JAR = 25*Q  +  10*D  +  5*N  +  P

50 DLRS = INT(0.01*JAR) : CNTS = JAR - 100*DLRS

60 PRINT "The value of the coins in the jar is "; DLRS; " dollars and "; CNTS; " cents."

70 PRINT "Do you want to run the program again ?"

80 PRINT "Type [ Y ] for yes, or [ N ] for no."

90 INPUT A$ : IF  A$ = "Y" or A$ = "y" then PRINT : PRINT : GOTO 15

100 IF A$ = "N" or A$ = "n" then PRINT "OK.  Thank you.  BYE."

110 END

(This is the most up-to-date software development language I know how to use.  But I'm a dinosaur.  You're free to implement the application in any system where you feel more comfortable.)