Assignment B - Super Substitute Teachers

advertisement
TEJ 2O
Unit 4
Problem Sheet - B
Date:
Using a problem-solving model and style guide, write computer programs that:
1. Convert the value of the Canadian dollar against the American dollar. Input an amount of
money in Canadian dollars. Output amount in American dollars. The amounts should be
formatted in dollars and cents. Save this program as dollarB
2. Use a conversion factor that changes inch measurement into centimetres. Input the length
and width of a rectangle in inches. Output the length, width, and perimeter in metric form.
Save this file as convertB
3. Input any real value for x. Output the value for y where y = (x^3 - 3x^2 + 5x)/(x^2 ). Save this
file as mathB
4. Output the natural numbers from 1 to 30. The natural numbers are {1, 2, 3, 4 …} Save this
file as naturalB
5. Input any natural number called number. Output the natural numbers from 1 to number.
Save this file as natural2B
6. Input any natural number called number. Output the even natural numbers from 2 to
number. Save this file as evenNaturalB
7. Input two natural numbers called number1 and number2 where number2 is bigger than
number1. Count down from number2 to number1. Save this file as countDownB
8. Output a chart with the titles NUMBER SQUARE CUBE. Under the appropriate column,
output the numbers from 1 to 20, their squares, and their cubes. Save this file as squaresB
9. Recall No. 6 from Problem Sheet No. 1 and calculate gross pay for the employees. Save this
file as grossB
10. Use the Boolean operators AND, OR, NOT, and XOR in simple programs. (Hint: Use your
truth tables to help.) Save this file as booleanB
Download