TODO8 - Use a multi-way if/else statement to synchronize the ball state to the paddle state.
"public void paddleAndBallStateSynchronization()"
   
  1. Find the TODO8.java starter file; this empty class also serves as a solution you can experiment and play with.
  2. Next, read all of the comments at the top of the file in the file header.
  3. Set your runner in Main.java to use TODO8.java and comment out any other setRunner calls. (see the stepwise approach for more details)
  4. Determine the single function you need to declare inside the empty class. It's described in the comments and also at the top of this webpage.
  5. Declare the function "public void paddleAndBallStateSynchronization(){}" and leave it empty and rerun the game - do you notice anything different?
  6. Inside your method, you must build one if statement that asks: "if the paddle state is FIRE, then call some method to set the ball state to FIRE."
  7. Extend the if statement using an "else if" clause and next ask: "else if the paddle state is ICE, then call some method to set the ball state to ICE."
  8. Extend the if statement using an "else if" clause and next ask: "else if the paddle state is NORMAL, then call some method to set the ball state to NORMAL."
  9. Inside your if statements, you'll need to call one or more API functions to get the state of the paddle and set the state of the ball; the API function you'll need are are described in the comments and also listed here for reference:

  10. Method Signature Description
    PaddleAndBallStatesEnum paddleGetState() returns the current state of the paddle as one of the following: {FIRE, ICE, NORMAL}
    void ballSetState(PaddleAndBallStatesEnum state) call this function to set the state of the ball to one of the following: {FIRE, ICE, NORMAL}

    Type Values
    PaddleAndBallStates {NORMAL,FIRE,ICE}


A Ball in sync with the ICE Paddle above.

A Ball out of synch with the FIRE Paddle below.