Control Constructs

Additional Exercises


  1. An employee in a company is paid at a rate of £5.20 per hour. The standard rate is paid for up to 37 hours worked in a week, after which 1.5 times the standard rate is paid. 22% tax is deducted from the gross pay as well as 5% for national insurance and 6% for the company pension scheme. If the employee works less than 20 hours a week, the income tax rate is only 20%.

    Write a program to read in the hours worked and calculate the employees pay, displaying the gross salary and all the deductions as well as the net take home pay.

    Remember to make proper use of constants.

  2. A leap year is a year which is exactly divisible by 4, unless it is exactly divisible by 100 in which case it is only a leap year if it is exactly divisible by 400. Write a program which prompts the user for a year and then displays if it is a leap year or not.


Back to Main Page for Lecture 3