Please answer correctly with explanation

Please answer correctly with explanation

JAVA

I need help writing Java code for this method “public void throwDart(ThrowType type, int number)” which simulates the action of the current player throwing one dart, adjusting the points as needed, and adjusts the players dart count. Switches to the other player if the current player uses up all darts or busts; does not switch to the other player if the current player wins. Does nothing if the game is already over. The number parameter is ignored in the case of type MISS, OUTER_BULLSEYE, or INNER_BULLSEYE.

Busts means : the players score goes negative, gets to 1, or gets to zero but not ona double or inner bullseye, the player has gone bust, and their score is reset to whatever it was at the beginning of their turn, and the turn ends even if they haven’t thrown all their darts.

Here are some test cases:

g = new DartGame(1, 100, 3);
g.throwDart(DOUBLE, 10);
System.out.println(g);
g.throwDart(DOUBLE, 10);
System.out.println(g);
g.throwDart(DOUBLE, 10);
System.out.println(g);
g.throwDart(DOUBLE, 10);
System.out.println(g);
System.out.println();
// Expected:
// Player 0: 100 Player 1: 80 Current: Player 1 Darts: 2
// Player 0: 100 Player 1: 60 Current: Player 1 Darts: 1
// Player 0: 100 Player 1: 40 Current: Player 0 Darts: 3
// Player 0: 80 Player 1: 40 Current: Player 0 Darts: 2

Complete Answer:

Get Instant Help in Homework Asap
Get Instant Help in Homework Asap
Calculate your paper price
Pages (550 words)
Approximate price: -
Open chat
1
Hello 👋
Thank you for choosing our assignment help service!
How can I help you?