Weekly Challenge #1 – Coffee Conundrums

This challenge is based on a true story. 

 

Bronze

Diego’s Coffee shop charges £1.40 for a cup of coffee. 

Write a program which asks the user how many cups of coffee they would like to order. The program should then output the total cost.

Silver

Diego’s Coffee shop has now introduced a loyalty scheme. After buying six cups of coffee, the seventh cup of coffee is free.

Write a program which asks the user how many cups of coffee they would like to order. The program should then output the total cost, factoring in the loyalty discount.

Hint

You may want to use integer division for this. In C# this happens by default. In Python you’ll need to wrap the equation inside int() like so: int(num1 / num2).

Integer division tells you how many times a number fully goes into another with no remainder. Normally, 4/5 would equal 0.8, but using integer division it would equal 0. Similarly, 13/5 would normally equal 2.6, but using integer division it would equal 2.

Gold

Caffè Faroe charges £1.30 per cup of coffee. After buying ten cups of coffee, the eleventh cup of coffee is free.

Write a program which asks the user how many cups of coffee they would like to order. The program should then tell the user which coffee shop will be cheaper.

Good luck!