Question
Hi, how do I translate the following code(s) in UML? void update() { if ( currentState == MAIN_MENU ) { drawMainMenu(); checkMenuButtonClicked(); ... } else
Hi, how do I translate the following code(s) in UML?
void update() { if( currentState == MAIN_MENU ) {
drawMainMenu(); checkMenuButtonClicked();
...
} else if( currentState == IN_GAME ) {
}
drawCharacters();
drawInterface();
getCurrentMove();
}
}
---------------------------------------------------------------------------
abstract class State { protected Game game; abstract void handleUpdate(); State(Game g) { game = g; }
}
class CharSelect extends State {
void handleUpdate() {
if selectedChar()
return new InGame(
..., selectedChar());
}
}
------------------------------------------
class Working {
ProcessState update() {
if( stuffToProcess() )
processStuff();
return new Working();
else
return new Waiting();
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started