RHS =>  Allan =>  Basic Programming => Exercises => Bookmaker2 Updated:  02/02/2004 23:36
WebMaster: allanhn@rhs.dk

Bookmaker 2

Solving this assignment you'll need the class Reciept from the Bookmaker assignment.
Download it here: Reciept.java

Assignment
As you are going to change the content of the class start by saving it using another name - use Reciept2.java

Add an attribute that holds information of the odds for the bet made.
The odds-value tells how many times the customer wins back his/her money.
For example if odds = 2.3, amount = 150 and the customer wins he/she will get 150 * 2.3 = DKK 345.0 back.

Remember to change the constructor with parameters and to add a metod that sets the value of the odds attribute.


Also add a method that determines whether the user wins or not.
The method should recieve a string with the result.
If the result is the same at the bet the method should return true otherwise it should return false.


Finally add a method that return the amount won.
The method should recieve a string with the result.
If the result is the same as the bet the method should return the amount won (odds * amount) otherwise it should return zero.

Test Reciept2 in a class - Bookmaker - where you give an example of a customer that wins (print the amount won) and a customer that doesn't win (print a message telling that).

I must have your solution before the 21th October.