A window cleaner uses the following pricing policy to calculate how much to charge for cleaning all the windows of his customer’s dwelling. This pricing policy is based on the number of windows that need to be cleaned and works as follows:
- All quoted prices include a fixed call out fee of £10,
- Then, the first five windows are charged at £2 each,
- The next five windows are charged at £1.50 each,
- Any additional windows are charged at £1 each.
Your task is to write a computer program that prompts the end-user to enter the number of windows of their dwelling. The program will then calculate the quoted price using the pricing policy described above and display it to the end-user.
Now that you have implemented the cost calculator for the house cleaner, you are going to test your code by completing the following tests: see test plan below. For each test compare the outcome of your program with the expected outcome. If these are different then you’ll need to review and tweak your code.
|Test #||Input values||Expected outcome||Actual outcome|
|1||Number of windows: 3||Cost: £16|
|2||Number of windows: 5||Cost: £20|
|3||Number of windows: 7||Cost: £23|
|4||Number of windows: 9||Cost: £26|
|5||Number of windows: 10||Cost: £27.50|
|6||Number of windows: 11||Cost: £28.50|
|7||Number of windows: 13||Cost: £30.50|
|8||Number of windows: 15||Cost: £32.50|
At the beginning of the year, the house cleaner wants to attract new customers by offering a 10% discount to all quoted prices.
Adapt your code to include a 10% discount in the quoted price.
Solution...The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area