I want to ask the user if they want to hold the cards or not,if the user want to hold cards, change other cards to a random cards (change suits and ranks).And i want to print out all the cards after changes.The rule is the same as normal video poker.
import java.util.Random;
import java.util.*;
import java.util.Arrays;
public class Card
{
String[] suits = { "hearts", "spades", "diamonds", "clubs" };
String[] ranks = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9","10","Jack", "Queen", "King" };
Random suit = new Random();
Random rank = new Random();
public String getSuitsArrayElement()
{
return suits[suit.nextInt(suits.length)];
}
public String getRanksArrayElement()
{
return ranks[rank.nextInt(ranks.length)];
}
public changecard()
{
}
}
import java.util.Scanner;
public class VideoPokerSimulator
{
public static void main(String[] args)
{
Card one= new Card();
Scanner q = new Scanner(System.in);
for(int i=0; i<5; i++)
{
String a=one.getSuitsArrayElement()+one.getRanksArrayElement();
System.out.println(a);
}
System.out.println("Which cards do you want to hold?");
String i = q.next();
}
}
Aucun commentaire:
Enregistrer un commentaire