A CD manufacturing company charges Multimedia companies $6.50 per CD if they create less than 1000 copies. If the company requires more than 10000, they only pay $5.00 a copy. Otherwise, they pay $5.70 a copy. Write a program that will allow the company to calculate how much to charge for different jobs they do. Use the extended If..Then..Else statement.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
BEGIN
INIT copies AS INTEGER
INIT price, total AS FLOAT
INPUT(copies)
IF copies < 1000 THEN:
price <- 6.50
ELSE IF copies > 10000 THEN:
price <- 5.00
ELSE THEN:
price <- 5.70
ENDIF
total <- price*copies
OUTPUT(total)
END
Write a program that will display 6 different comments based on the results of random numbers from 1 to 6. Use the Select Case statement.
1
2
3
4
5
6
7
8
9
10
11
12
BEGIN
INIT num AS INTEGER
num <- RANDOM INT
CASE num OF:
1 : OUTPUT(1)
2 : OUTPUT(2)
3 : OUTPUT(3)
4 : OUTPUT(4)
5 : OUTPUT(5)
6 : OUTPUT(6)
ENDCASE
END
Most countries use a sliding scale income tax program based on the amount of money earned. Here is an example of the tax on an individual’s weekly income: