Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Write a program in JAVA.
Write a program in JAVA.
Import java.io. *;

Import java.util. *;

Common class point {

Static int h =1; Static int g =1; Static int f = 0;; Static int fenshu = 0;; int m 1 = 0; int n = 0; Static int e = 0;; Static int d = 0;; //d represents the sum of home completion points.

Static string pai[]={ "hearts", "spades", "hearts" and "grass flowers"};

static int shu[]={ 1,2,3,4,5,6,7,8,9, 10, 1 1, 12, 13 };

Public static int Qu Zhi ()

{

int m 1 =(int)( 13 * math . random()+ 1);

Returns m1;

}

public static int quzhi2()

{

int n =(int)(4 * math . random()+ 1);

Returns n;

}

Public static void choupai()// Players draw cards.

{

Int m = Shu[ Qu Zhi ()];

system . out . println(pai[qu zhi 2()]+m);

If (m>10) m =1;

system . out . println(" points "+m);

d = m+d;

System.out.println ("player's total score"+d);

if(d & gt; 2 1) {System.out.println ("you lost"); g = 0; }

}

Public static void choupai1()/The dealer draws cards.

{

Int m = Shu[ Qu Zhi ()];

system . out . println(pai[qu zhi 2()]+m);

If (m>10) m =1;

system . out . println(" points "+m);

e = m+e;

System.out.println ("total banker points"+e);

if(d & gt; 2 1) {System.out.println ("You win"); f = 1; h = 0; }

}

Public static void main(String[] args) throws IOException {

Chou pai();

Chou pai 1();

Chou pai();

Chou pai 1();

Scanner in = new scanner (system. in);

System.out.println ("Please press1"for another card);

int b = in . nextint(); //receive shaping data

if(b = = 1){ Chou pai(); }

if(g== 1){

Scanner in2 = new scanner (system. in);

System.out.println ("Please press1"for the dealer to play another card);

int b 1 = in2 . nextint(); //receive shaping data

if(b 1 = = 1){ Chou pai 1(); } else h = 0; }

if(g== 1){

Scanner in 1 = new scanner (system. in);

System.out.println ("Please press 2 for another card");

int c = in 1 . nextint(); //receive shaping data

if(c = = 2)choupai();

else if(d & gt; E& & amp<21) {system. out.println ("player wins"); f = 1; }

Else System.out.println ("you lost"); }

if(h = = 1 & amp; & ampg== 1){

Scanner in3 = new scanner (system. in);

System.out.println ("Please press 2 for the dealer to play another card");

int c 1 = in3 . nextint(); //receive shaping data

if(c 1 = = 2)Chou pai 1();

If (e & gtD) {System.out.println ("you lost"); }

Else {System.out.println ("You are dead meat"); f = 1; }}

if(f = = 1)fenshu = fenshu+5;

System.out.println ("Your score is"+fenshu);

f = 0; g = 1;

}

}

Simple version of two people, no king of size. Wait for the master to answer.