Three for Two Tutorial

From Progzoo
Jump to: navigation, search

The function Math.min gives the minimum of exactly two numbers. if we want to calculate the minimum or three numbers or four numbers we can get the minimum of a minimum.

If we want to find the minimum of more numbers there are other techniques.

Discount on Three for Two

There is a "three for the price of two" offer on books. If three books are purchased there is a discount equal to the cheapest.

Use the Math.min function to find the smallest of three numbers.



[Font] [Default] [Show] [Resize] [History] [Profile]

Price of Three for Two

There is a "three for the price of two" offer on books. If three books are purchased there is a discount equal to the cheapest.

Find the cost to the customer of three books. That is, the price of the two most expensive books.



[Font] [Default] [Show] [Resize] [History] [Profile]