1

The Game is called Twenty-One.           The user rolls dice in an attempt to hit exactly...

Question

The Game is called Twenty-One.           The user rolls dice in an attempt to hit exactly...

The Game is called Twenty-One.

          The user rolls dice in an attempt to hit exactly 21. If the user goes over 21, they lose. If they hit 21 exactly, they win. Pop upa message box that informs the user if they win or lose. Then they can play the game again if they want.

          At first the user should roll 2 dice. Once their total hits 15 or above, they should only roll one dice. (Use a random number generator to simulate the dice rolls.)

Build a GUI to display all the Game Data back to the user. Maybe include a roll button that the user can press to roll the dice. Also maybe include a button that says “Play Again”, that the user can press to play the game another time.

Answers

public class Lab5 {      public static void main(String[] args) {         // TODO Auto-generated method stub           //variables         int dice1;         int dice2;           //Call the welcome method         welcome();          //fetch random numbers           /*          * **************************************************************          *welcome method          *welcome user          *no parameters          *no return          ****************************************************************          */     }     public static void welcome() {         System.out.println("Welcome to a Lucky (for me) Dice Game! \nFEELING LUCKY?!? Hope you brought lots of CASH!");{     }      int dice1=(int)(Math.random()*6+1);     int dice2=(int)(Math.random()*6+1);     int sum= dice1 + dice2;      System.out.println("Roll: total = " +sum);       if (sum==2|| sum==3|| sum==12){     System.out.println("Sorry with a " + sum + " You LOSE :("); }     else if(sum==7 || sum==11) {      System.out.println("Woah!!! With a " + sum + " You WIN!!!!!!!"); }      else{      if(sum==4 ||sum==5 ||sum==6 ||sum==8 ||sum==9 ||sum==10)      dice1=(int)(Math.random()*6+1);     dice2=(int)(Math.random()*6+1);}     int roll2 = dice1 + dice2;}     System.out.print("You rolled "+roll2+"  ");{     while (roll2 !=7){     if (roll == roll2);{     System.out.println("You Win !");     break;     }else{          }     } }} 


Similar Solved Questions

1 answers
Anyone who can assist me? What is the major Organic product from the following sequence of...
Anyone who can assist me? What is the major Organic product from the following sequence of reactions? 1) NaNH 2) Br Hi (c) NH 0 is NH (d) (e) (1) a. a b.b - с. с ad e. e Off...
1 answers
2 Required Information Use the following information for the Exercises below. (The following Information applies to...
2 Required Information Use the following information for the Exercises below. (The following Information applies to the questions displayed below Part 2 of 2 During April, the production department of a process manufacturing system completed a number of units of a product and transferred them to fin...
1 answers
Please give me the structure Name and properties for that with deatels thanks 135.pdf (page 1...
please give me the structure Name and properties for that with deatels thanks 135.pdf (page 1 of 2) ZU @ Q Search 13C NMR 128.28 129.097 ,6 125.38 21.4) 137.83 TTTTTTTTTT TTTTTTTTT 200 180 160 140 120 100 80 60 40 20 0 ppm I IH NMR MacBook Air 'H NMR * 2.318 (3) r 7.061(2) 7.138 - (2) K7.0...
1 answers
2c. I have to split this question into 2 parts because of the way Canvas works....
2c. I have to split this question into 2 parts because of the way Canvas works. This first part asks you to fill in the missing words of the question. About of the variability in [Select] can be explained by [Select] [Select) GPA Hours Playing About of the variability of (above question) can be expl...
1 answers
Problem 15-21 Determining and interpreting flexible budget variances LO 15-5 Narcisco Publications established the following standard...
Problem 15-21 Determining and interpreting flexible budget variances LO 15-5 Narcisco Publications established the following standard price and costs for a hardcover picture book that the company produces. Standard price and variable costs Sales price 90.00 Materials cost 18.00 Labor cost Overhead c...
1 answers
375 mg of penicillin was prescribed for an elderly patient with pneumonia. The drug comes in...
375 mg of penicillin was prescribed for an elderly patient with pneumonia. The drug comes in tablets of 500 mg. How many tablets should be given? Label all numbers with its corresponding unit and drug Place zeros in front of decimals (0.1)...
1 answers
Dtioh before Problemt vapor at 200 kPa. mixing it with saturated water Cold liquid water T,...
dtioh before Problemt vapor at 200 kPa. mixing it with saturated water Cold liquid water T, 20-C -200 kP Water Unknown quality P, 200 kPa Mixing Chamber Saturated water vapor P 200 kPa What is the enthalpy for the cold water (stream 1)? What is the enthalpy for the saturated vapor (stream 2)? If bot...
1 answers
6. Use the standard reduction best oxidizing agent. potentials bdlow to determine which element or ion...
6. Use the standard reduction best oxidizing agent. potentials bdlow to determine which element or ion is the 3 E。= +0.789 V B" = +0.535 V Hig22+(aq) + 2 e-→ 2 Hg (1) Ni"(aq) + 2 e-→ Ni(s) I- (aq) Hg 1) 12(s) + 2 e→ 2 I-(aq) E°=-0.25 V d) 12(s)...
1 answers
Help asap 12. manufacturing over head was estimated to be $484,800 for the year along with...
help asap 12. manufacturing over head was estimated to be $484,800 for the year along with 20,200 direct labor hours. Actual manut acturing overnead was $445,610 and the actual labor hours uer 21,200. the amount of manufacturing overhead applied to production would bei $184, 800 -$1524,700 $508,8...
1 answers
The current answer listed is incorrect. <Homework 4 Problem 21.74 ® 2019 » m Review Constants...
The current answer listed is incorrect. <Homework 4 Problem 21.74 ® 2019 » m Review Constants Periodic Table rail A proton follows the path shown in (Figure 1). Its initial speed is vo = 2.5x10 m/s. What is the proton's speed as it passes through point P? Express your answer to two ...
1 answers
I understand most of this, but having trouble with C. Correct answers are shown, all I...
I understand most of this, but having trouble with C. Correct answers are shown, all I need to know is how to work through the problem. Please show work Country C produces 1,000 pounds of cotton at a cost of 50 cents per pound. They sell all of the cotton to Country S for 75 cents per pound. Country...
1 answers
1. Reason for subnetting 2. Internet partitioning from routing perspective
1. Reason for subnetting 2. Internet partitioning from routing perspective...
1 answers
A mixture of Csli vapor and air having an air coefficient of 0.9 is burnt in a spark ignition engine at constant vo...
A mixture of Csli vapor and air having an air coefficient of 0.9 is burnt in a spark ignition engine at constant volume. The pressure and temperature of charge at begging of combustion are I MMPa and 610"K, Calculate the pressure and temperature at the end of combustion. The lower calorific valu...
1 answers
Photosynthesis Worksheet 1. Write the overall reaction for photosynthesis: 2. What does photosynthesis require in addition...
Photosynthesis Worksheet 1. Write the overall reaction for photosynthesis: 2. What does photosynthesis require in addition to water and carbon dioxide? 3. What is the principal pigment of plants? 4. Circle the letter of the region(s) of the visible spectrum in which chlorophyll absorbs light best. a...
1 answers
Reflecting 1: health program setting ( for the precede - proceed assignment) Start considering a location and populatio...
Reflecting 1: health program setting ( for the precede - proceed assignment) Start considering a location and population you plan to use in your precede- proceed program plan assignment by responding to the prompts below: A. Briefly describing setting ( hospital, community, school, workplace etc) an...

-- 0.035609--