Selection Challenges

Write programs for each of the following problems

1. When the child is under 5 there is no charge to get in the cinema.  For children who are 5 or older the charge is £3.

2. If someone earns more than £100 they pay tax at 10% of gross.  For less than this, tax is charged at 9% of gross.

3. When the cost of the meal is more than £100 there is no service charge.  For other meals the service charge is 10%

4. The student was asked if they liked JavaScript.  If they answered with a ‘Y’ the computer displays ‘You have good taste!’.  If they answered with an ‘N’ the computer displays ‘We can’t all have brains!’.

5. A program is required to input 2 integer values and display a message indicating if one is an exact divisor of the other (i.e. the remainder is 0), e.g. 4 divided by 2 = 2 remainder 0.

Next: Iteration