Custom Search
 
  

 
CHAPTER 6

EXERCISE SOLUTIONS

The solutions to the exercises could be written this way:

Since the service number heading is longer than the data, your spacing may be one (1) or two (2) spaces different from the one shown, depending on how you choose to arrange the odd number of spaces.

Positioning of the output data in the output line is left to your discretion. The primary concern is that you know how to construct the image statement and perform the rounding function.

3. 10 LET Y = .01

20     FOR X = 1 TO 30

30     LET Y = Y*2

35     PRINT USING 36,Y

36     %$###,###,###.##

40     NEXT X

99     END

RUN

$0.02

$0.04

$0.08

$0.16

$0.32

$0.64

$1.28

$2.56

$5.12

$10.24

$20.48

$40.96

$81.92

$163.84

$327.68

$655.36

$1,310.72

$2,621.44

$5,242.88

$10,485.76

$20,971.52

$41,943.04

$83,886.08

$167,772.16

$335,544.32

$671,088.64

$1,342,177.28

$2,684,354.56

$5,368,709.12

$10,737,418.24

4.    10    REM THIS PROGRAM GIVES THE DISCOUNTED

11    REM PRICES FOR A LIST OF ITEMS

15    DIM I$(4),U(4)

20    PRINT "ENTER DISCOUNT RATE,.XX"

30    INPUT D

40    PRINT USING 50,D*100

50    %DISCOUNTED PRICES AT ##%

60    PRINT USING 70

70    % ITEM         PRICE

80    FOR X = 1 TO 4

90    READ I$(X),U(x)

100    LET P = U(X) (U(X)*D)

110    PRINT USING 120, I$(X),P + .005

120    %##########         $#,###.##

130    NEXT X

200    DATA "TIRES",379.95,"BATTERY",61.95

210    DATA "ENGINE",1032.50,"FUSES",.55

900    END

RUN

ENTER DISCOUNT RATE,.XX

?.10

DISCOUNTED PRICES AT 10%

ITEM         PRICE

TIRES        $341.96

BATTERY  $55.76

ENGINE     $929.25

FUSES         $0.50







Western Governors University
 


Privacy Statement - Copyright Information. - Contact Us

Integrated Publishing, Inc. - A (SDVOSB) Service Disabled Veteran Owned Small Business