Bag Of Cows

Pseudo Code Library

Shoe Cost Calculator

You are creating a program for a new company, Diamond Geezer Shoes, which sells hand made trainers which are encrusted with diamonds. They are aiming to make this an expensive high fashion choice, which means that they have very specific ideas on who they would like to market their shoes to.

The shoes come in sizes from 7 to 13, and have a basic cost of £1000 per pair. The number of diamonds needed obviously depends on the size of the shoe, so there is an additional cost of £200 for every shoe size over 7. So for example a pair of shoes in size 10 will cost £1000 + £200 * 3 (the difference between 10 and 7), = £1000 + £600 = £1600.

The idea is to associate the diamond shoes with self-made wealthy people aged between 25 and 40. They don't want people without their own independent wealth to wear them, so they won't sell them to people under 20, as these people aren't old enough to have made their own money, and are probably getting them as a gift. They will grudgingly sell them to the over 40s, but the price goes up by a sliding scale of 1.5 * the cost for the 40-50 age group, or double the cost if over 50.

So for example, the size 10 pair of shoes for someone aged 20 to 40 is £1600. Someone aged 19 can't buy them. Someone aged between 41 and 50 pays 1.5 * £1600 = £2400. Someone aged 51 or over pages 2 * £1600 = £3200.

In summary:

  • Shoes come in sizes 7 to 13
  • The cost goes up by £200 for each size over 7
  • The customer age must be 20 or more
  • If the customer age is over 40, the cost goes up by half as much again
  • If the customer age is over 50, the cost is doubled.

Your program should

  1. Allow the customer to enter their
    • Name
    • Age
    • Shoe Size
  2. Check that they are allowed to buy shoes
  3. Check that they are a size we sell
  4. Give them a customised quote including their name and the cost of the shoes.

Flowchart for the program

Testing

You will need to plan how to test your program. Write the test plan BEFORE you do the code, and work out what the cost of the shoes should be by hand.

Test Number What is being tested Test Data Expected Outcome Actual outcome
1 Age validation Customer name: Bob
Age is 19
Shoe size 9
   
2 Age validation Customer name: Bob
Age is 20
Shoe size 9
   
3 Age validation Customer name: Bob
Age is 21
Shoe size 9
   
4 Size validation Customer name: Bob
Age is 30
Shoe size 6
   
5 Size validation Work out what to put here yourself
6 Size validation Work out what to put here yourself
7 Size validation Work out what to put here yourself
8 Cost calculation Customer name: Bob
Age is 30
Shoe size 11
   
9 Cost calculation Customer name: Bob
Age is 30
Shoe size 9
   
10 Cost calculation Customer name: Bob
Age is 45
Shoe size 9
   
11 Cost calculation Customer name: Bob
Age is 53
Shoe size 9
   
If you do the extension, you will need to test two names for that.

Extension

The owner of the company, Mr Gerald Cobbler, is interested in alternative and ancient religions, and firmly believes is the principle of Nominative Determinism. He has develped these ideas and become convinced that anyone whose name contains all 5 vowels would provide excellent celebrity marketing for the shoes, and should get them for free.

Adapt the program so that if the customer name contains all of the letters A,E,I,O,U, they get their shoes free.

You can test it with the name of the famous Italian philosopher, rock star and sports car designer, Anton DiLeachou.