UML diagrams and Object Oriented programming
In a project for CSC120 at school we have to program a casino using java. We were given a UML diagram of how the professor wants it set up, and I am having some difficulty understanding exactly what some of this means, code wise.
Part of the UML diagram:
__
Game
_
userMoney: int
bet: int
_
playAgain() : bool
askBet() : int
Payout(amt: void) : void
takeBet(amt:void) : bool
I understand the first two blocks, but the last one confuses me. I get that these are the different functions the class will use, but what does the text inside the parentheses mean, and the text after the colon? And what would this look like in code? If someone could post a link to an example program it would greatly help, or just post a simple example here.
Here is what I have so far in the class file:
/*
* ASCIIcasino.java
* Version 1.0
* Alachine
* Last Modified: 01/19/2006
*
*/
publicclass Game
{
int usermoney;
int bet;
publicboolean playAgain()
{
}
publicint askBet ()
{
do
{
System.out.println("How much do you wish to bet?");
scannergameinput =new Scanner(System.in);
}
while(!scannergameinput.hasNextInt());
bet = scannergameinput.nextInt();
System.out.print("Your bet: ");
return bet;
}
publicvoid Payout ()
{
int amt;
}
publicboolean takeBet ()
{
int amt;
}
}
Am I doing this correctly so far, or what am I not getting? Thank you for your time.
Edited to update code.
Message was edited by:
Alachine

