Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a java UML diamgram for the following program: import java.util.Scanne

ID: 3670230 • Letter: I

Question

Implement a java UML diamgram for the following program:

import java.util.Scanner;
import java.util.Random;

public class spinnerGame
{
public static void main (String[] args)
{
int cash = 100;
char gameHost;
  
Scanner numGuess = new Scanner(System.in);
System.out.println("---------------WELCOME!---------------");
System.out.println("Welcome to the Spinning game!");
System.out.println("The Spinner has 10 numbers from 1-10.");
System.out.println("You currently start off with $100");
System.out.println("--------------------------------------");
  
Random r1 = new Random();
int rand1 =r1.nextInt(10)+1; // getting a random number for the start
  
System.out.println("The Spinner is currently at: " +rand1); //spinners current position
System.out.println("Do you wish to play?");
  
char decision = numGuess.next().charAt(0); // taking decision
  
while (decision !='n')
{
int rand2 = r1.nextInt(10) +1; // taking a number to compare with previous spin
  
System.out.println("Input H for High and L for Low"); //player selects option
  
gameHost = numGuess.next().charAt(0);
  
System.out.println( "you spin a "+rand2); //printing the present spin number
  
if (cash != 0)
{
switch (gameHost)
{
case 'H': // if you select High 'H'
case 'h': // if you select lowercase

if (rand2 > rand1) // if you win
{
System.out.println("You win!");

cash =cash +10; // adds an additional $100 to current

System.out.println("You currently have $"+cash+" total");

}

else if (rand2 == rand1) // if the result matches
{
System.out.println("It's the same number");
System.out.println("You currently have $"+cash+" total");
}
else // if you lose
{
System.out.println("You lose");

cash =cash -10; // subtracts $10 from current

System.out.println("You currently have $"+cash+" total");
}

break;

case 'L':
case 'l':

if (rand2 < rand1) // if you win
{
System.out.println(" You Win!");

cash = cash + 10; //adds to your winnings

System.out.println("You currently have $"+cash+" total");
}

else //if you lose
{
System.out.println("You Lose..");
  
cash = cash -10;//subtracts 10 from current
  
System.out.println("You currently have $"+cash+" total");
}

break;

default:

break;

}
}
  
rand2 = rand1; //saving present spin value to create a new random one
  
System.out.println("Do you want to play again?"); // replay
System.out.println();
System.out.println("Press y to continue or n to quit");
  
decision = numGuess.next().charAt(0); //yes or no... with 'y' or 'n'
}
  
System.out.println("Congratulations! your total earnings today is $"+cash+" Have a good day");//final amount
  
  
}
}

Explanation / Answer

1. Use eUML2 plugin from Soyatec, under Eclipse and it works fine for the generation of UML giving the source code.

2. Class Visualizer does it. It's free tool which has all the mentioned functionality.For each browsed class it shows 2 instantly generated class diagrams: class relations and class UML view. Works very well with big projects (thousands of classes).

3. MoDisco is the most powerful one (though probably not the easiest one to work with).

MoDisco is a generic reverse engineering framework but also includes some predefined features like the generation of class diagrams out of Java code that you need.

4. The Omondo Plugin for Eclipse.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote