Question 3 - Electricity Bill
Write a program to calculate my electricity bill. The electricity units are char ged at two different rates, the off peak units are 2.2p per unit and the peak units are 5.6p per unit. The standing charge is a flat rate of £8.50 per bill and VAT is add ed to the total bill at 8%. Write a program which reads in the current and past meter readings for the peak and off peak meters and then proceeds to calculate the total bill. The output should be neatly formatted on the screen and the programs should make use of constants.
Test Case Output
Enter the present peak meter reading: 100 Enter the past peak meter reading: 0 Enter the present off peak meter reading: 100 Enter the past off peak meter reading: 0 Cost of peak units 5.60 Cost of off peak units 2.20 Standing charge 8.50 Total VAT added 1.30 Total Bill 17.60
You may have chosen to format this on the screen in any way you want (there is no correct way) - but these are the correct outputs you should get for the inputs specified.
Question 4 - Temperature Conversion
Write a program which converts a user specified temperature from fahrenheit to degrees celcius.
Test Case
For an input temperature of 100 fahrenheit, the output value should be 37.777778.
Again this can be specified on the screen in any way but this is a test value to try.
Back to Main Page for Lecture 2 |