Zoo tutorials: [ SQL | Linux | XML ]
ProgZoo: [ Java | C# | VB | C++ | Perl ]
Log in

A Gentle Introduction to
Programming

Tutorial: Math.max

 

1. Commission Charges


Big

The commission charged for converting currency is 10% of the amount or £5, which ever is the larger.

We can use the function Math.max to solve this problem. The function, which is part of the core will return the larger of two numbers.

We do not need to use the if statement here (but you can if you want to)

2. Taxi charges


Big

A taxi ride costs £2.00 per mile, but there is a minimum charge of £3.00 for short distances.

3. Wicked Employers


Big

Academics are offered a pay ride of 3% or the rate of inflation, which ever is the lower.

Give the miserly salary of salary and in inflation rate of rpi; calculate the pay rise.