How can I add an intro method to this program so the Welcome to bla.docx - How can I add an intro method to this program so the\"Welcome to blackjack

How can I add an intro method to this program so the Welcome to bla.docx

This preview shows page 2 - 4 out of 8 pages.

How can I add an intro method to this program so the "Welcome to blackjack!" doesn't appear every round? Along with how can I put in a loop that allows the user to play again?import java.util.Random;import java.util.Scanner;public class Blackjack{String type;int currentcard;int total = 0; //total in handstatic int dealerTotal = 0; //dealer's totalstatic int playerTotal = 0; //player's total, static variables allow totals to be compared at the endRandom ran = new Random();Scanner sc = new Scanner(System.in); //to input whether player wants to hit or staypublic Blackjack(String player){type = player;System.out.println("Welcome to Blackjack! The game has now started.");��Deal();game();��
Background image
}void displayCard(){Card potato = new Card();int currentcard = potato.drawCard();String suit = potato.getSuit();while(currentcard == 0){currentcard = potato.drawCard(); //draws cards}switch(currentcard){ //cases 11, 12, 13 = user drew a J, Q, or Kcase 11:System.out.println(" Jack " + suit);total = total + 10;System.out.println(type + " Current total: " + total);break;case 12:
Background image
Image of page 4

You've reached the end of your free preview.

Want to read all 8 pages?

  • Fall '19
  • Playing card, Spades, currentcard, static int dealerTotal

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture