Chat with us, powered by LiveChat Programming | Economics Write

For Task 5, you will be converting your Raptor flowchart into a Java program using Netbeans. Disregard any reference to Lesson 4 in the video. I changed the requirement to turn in the java solution this term. Play Video video Link: your java solution on your VM and submit your project report. Here is the code snippet in Java for using the Random class to create a random number for determining the winning color for each round (If you are not using this in your code then please contact me to explain what you are doing): int winningColor=0; Random rand=new Random(); /// first figure out the round winning color if (rand.nextFloat()<.5){ // float 0-1 like Raptor Random winningColor=0; } else{ winningColor=1; } Here is the code snippet for using the JOptionPane.showOptionDialog. This is how you would model the user input choice between red and black using a window. You do not have to use this. The output of this code would be 0 for red and 1 for black. int userColorChoice=0; Object[] options={"Red", "Black"}; //array that stores the choices userColorChoice=JOptionPane.showOptionDialog(null, // component "Select Red or Black", //Message "Current Bank: $"+bank, //title bar JOptionPane.YES_NO_OPTION, //specific type of options, y,n,c JOptionPane.PLAIN_MESSAGE,//icon in dialog box null, //icon options, //selections from an array options[0]); //default option System.out.println("Winning COlor is:"+ winningColor); System.out.println("User chose "+userColorChoice+" (red is 0, black is 1)"); Now create the Red-Black game in Java (Netbeans) on the Skytap VMs.Make sure you review my comments from Lesson 4's feedback. After you finish coding the game, MGM would like you to play the game 3 times and see what your average winnings or losses are. You can use any betting strategy you would like. Report on your strategy (e.g. I bet half my bank every round) and your overall bank status for each time you play. *************************OPTIONAL********************************************** Challenge: Can you automate the running of multiple games? Running it just 3 times manually gets a little tiresome. Can you imagine if you ran it 100 times? Part A: Intellectual discussion on how you change the variables and program to work in an automated fashion. Part B: Convert to Raptor or Java (choose 1) limit yourself to 1 hour

error: Content is protected !!