1
0
mirror of https://github.com/rfivet/BCG101.git synced 2024-12-28 21:16:25 -05:00
BCG101/port/TRAIN.BAS

22 lines
646 B
QBasic
Raw Normal View History

2024-05-03 22:40:24 -04:00
4 PRINT "TIME - SPEED - DISTANCE EXERCISE"\PRINT
5 RANDOMIZE
10 C=INT(RND(1)*25)+40
15 D=INT(RND(1)*15)+5
20 T=INT(RND(1)*19)+20
25 PRINT " A CAR TRAVELING"C"MPH CAN MAKE A CERTAIN TRIP IN"
30 PRINT D"HOURS LESS THAN A TRAIN TRAVELING AT"T"MPH."
35 PRINT "HOW LONG DOES THE TRIP TAKE BY CAR";
40 INPUT A
45 V=D*T/(C-T)
50 E=INT(ABS((V-A)*100/A)+.5)
55 IF E>5 THEN 70
60 PRINT "GOOD! ANSWER WITHIN"E"PERCENT."
65 GOTO 80
70 PRINT "SORRY. YOU WERE OFF BY"E"PERCENT."
80 PRINT "CORRECT ANSWER IS"V"HOURS."
90 PRINT
95 PRINT "ANOTHER PROBLEM (YES OR NO)";
100 INPUT A$\PRINT
105 IF A$="YES" THEN 10
999 END