| RHS => Allan => Basic Programming => Exercises => Bookmaker |
Updated:
02/02/2004 23:36 WebMaster: allanhn@rhs.dk |
Bookmaker
Assignment
At a bookmaker you can bet money on the result of a football match between
Denmark and China.
When a customer bets she gets a reciept with the following information:
Create a class for the reciepts.
You should be able to create the reciept
without any information (make a constructor without parameters).
Because of that, you should also be able to set the values of name,
amount and bet using set-methods
(i.e. public void
setName(String aName) { ... } and so on).
You should also be able to create a reciept passing the three needed values (make a constructor with three parameters: name, amount and bet).
Finally you should be able to print the data from a reciept (something like: "Allan bets DKK 100 that Denmark wins").
When you've made the class you should create a class with a
main-method.
In the main method you should create two Reciept objects.
One must be created
using the constructor with three parameters.
The other must be created using the constructor without parameters.
Then you
should set the three values using the set-methods.
Finally the main-method should print the two reciepts.
Mail me your two classes.
Remember to put your (english) name in the mail
and attach the two java-files.
I have to have your solution before the 6th October.