SHOW:
|
|
- or go back to the newest paste.
| 1 | ||
| 2 | public class FullHouse {
| |
| 3 | ||
| 4 | public static void printCard(int number){
| |
| 5 | if(number<=10) System.out.print(number); | |
| 6 | else{
| |
| 7 | switch(number){
| |
| 8 | case 11: System.out.print("J");break;
| |
| 9 | case 12: System.out.print("Q");break;
| |
| 10 | case 13: System.out.print("K");break;
| |
| 11 | case 14: System.out.print("A");break;
| |
| 12 | } | |
| 13 | } | |
| 14 | } | |
| 15 | ||
| 16 | public static void printSuit(int suitNumber){
| |
| 17 | char clubs = '♣'; | |
| 18 | char diamonds = '♦'; | |
| 19 | char hearts = '♥'; | |
| 20 | char spades = '♠'; | |
| 21 | switch(suitNumber){
| |
| 22 | case 1: System.out.print(clubs + " ");break; | |
| 23 | case 2: System.out.print(diamonds + " ");break; | |
| 24 | case 3: System.out.print(hearts + " ");break; | |
| 25 | case 4: System.out.print(spades + " ");break; | |
| 26 | } | |
| 27 | } | |
| 28 | public static void main(String[] args) {
| |
| 29 | - | |
| 29 | + | int counter = 0; |
| 30 | for(int firstCard = 2; firstCard<= 14 ; firstCard++){
| |
| 31 | for(int secondCard = 2; secondCard<=14 ; secondCard++){
| |
| 32 | if(secondCard==firstCard) continue; | |
| 33 | for(int firstSuit = 1 ; firstSuit<=4 ; firstSuit++){
| |
| 34 | - | for(int secondSuit = 2 ; secondSuit<=4; secondSuit++){
|
| 34 | + | for(int secondSuit = firstSuit+1 ; secondSuit<=4; secondSuit++){
|
| 35 | - | for(int thirdSuit = 3; thirdSuit <=4 ; thirdSuit++){
|
| 35 | + | for(int thirdSuit = secondSuit+1; thirdSuit <=4 ; thirdSuit++){
|
| 36 | for(int forthSuit = 1; forthSuit <=4 ; forthSuit++){
| |
| 37 | - | for(int fifthSuit = 2 ; fifthSuit<=4 ; fifthSuit++){
|
| 37 | + | for(int fifthSuit = forthSuit+1 ; fifthSuit<=4 ; fifthSuit++){
|
| 38 | printCard(firstCard); | |
| 39 | printSuit(firstSuit); | |
| 40 | printCard(firstCard); | |
| 41 | printSuit(secondSuit); | |
| 42 | printCard(firstCard); | |
| 43 | printSuit(thirdSuit); | |
| 44 | printCard(secondCard); | |
| 45 | printSuit(forthSuit); | |
| 46 | printCard(secondCard); | |
| 47 | printSuit(fifthSuit); | |
| 48 | System.out.println(); | |
| 49 | - | } |
| 49 | + | counter++; |
| 50 | } | |
| 51 | } | |
| 52 | } | |
| 53 | } | |
| 54 | } | |
| 55 | ||
| 56 | } | |
| 57 | } | |
| 58 | } | |
| 59 | } |