Next: Introduction to structured design Up: Further Assignment Statements & Previous: Multiple Choice Questions

Exercises

  1. Alter the program you wrote for exercise 2 in Lesson 7 so that the printed values for mileage and tank contents have two digits printed after the decimal point and the consumption in miles per gallon is printed with one digit after the decimal point.

  2. Amend your program for exercise 6 in Lesson 7 so that the output appears in a format as follows:
    Standing charge  9.02 pence for  61 days    5.50
    Gas consumption 1632.1 cu.m @ 1.433 pence  23.39
    Sub-total                                  28.89
    
    VAT at 8%                                   2.31
    
    Total                                      31.20
    
    Note that allowance has been made for future increases in the standing charge to more than 10 pence per day, and for the number of days to be anything up to 999. You may wish to consider suitable limits on the amount of gas consumed, in order that the format of you final output is not disrupted.



Next: Introduction to structured design Up: Further Assignment Statements & Previous: Multiple Choice Questions