Question

in java coorect this code & screenshoot your output ---------------------------------------------------------------------- public class UNOGame {     /**...

in java coorect this code & screenshoot your output

----------------------------------------------------------------------

public class UNOGame {

    /**

     * @param args the command line arguments

     */

   

    public static void main(String[] args) {

      Scanner input=new Scanner(System.in);

         Scanner input2=new Scanner(System.in);

             

              UNOCard c=new UNOCard ();

               UNOCard D=new UNOCard ();

                Queue Q=new Queue();

             

            listplayer ll=new listplayer();

          

           

   System.out.println("Enter Players Name :\n Click STOP To Start Game..");

  

    String Name = input.nextLine();

    ll.addplayer(new player(Name));

    

   while(true){

        ll.addplayer(new player(Name));

        Name = input.nextLine();

       

        if(Name.equalsIgnoreCase("STOP"))

            break;

     

   }

        ll.DisplayPlayer();

           

        c.StartCard();

        c.HANDCARD();

       

        System.out.println("Enter Card Number\n");

          int Number = input2.nextInt();

      

        

        

         D.push(new Card(Number));

         D.getTop();

        

        

        ll.Win();

    Q.addlast(new Queue (Name));

        

           

         D.push(new Card(Number));

        

        c.Win();

        ll.addplayer(Name);

        Q.addlast(Name);

        

           

  

    }

   

}

public class UNOCard {

       Scanner input=new Scanner(System.in);

       private static final int min=-1;

       private static final int max=14;

      

         private int card;

         private int color;

        

         private Card TOP;

         private int VALUE=card+color;

         private int size;

          int x=2;

            public static final int RED =-1;

            public static final int GREEN = -2;

            public static final int BLUE = -3;

            public static final int YELLOW = -4;

            public static final int NULL = -5;

           

            public static final int REVERSE = 10;

            public static final int SKIP = 11;

            public static final int DRAW_TWO = 12;

            public static final int WILD = 13;

            public static final int WILD_FOUR = 14;

           

        public UNOCard(){}

    /**

     * CONSTRACTOR THAT TAKE TOW PARAMETERS

     * @param color TO DEFINE CARD COLOR

     * @param card TO DEFINE CARD TYPE

     */

       public UNOCard(int color, int card)

       {

           this.card = card;

           this.color = color;

      

           TOP=null;

           size=0;

                       

            if (card == WILD || card == WILD_FOUR) {

            this.color = NULL;

        }

        }

       /**

        * GETTER FOR CARD COLOR

        * @return color

        */   

            if (card == WILD || card == WILD_FOUR) {

            this.color = NULL;

        }

        }

       /**

        * GETTER FOR CARD COLOR

        * @return color

        */   

       public int getColor(){return color;}

       /**

       * GETTER FOR CARD VALUE

        * @return card

        */

       public int getVaLue(){return VALUE;}

       /**

        * METHOD TO CHECK CARDS IS NUMBER OR ELSE

        * @return NUMBER

        */

       public boolean isNumber(){return(card >= 0 && card < 10);}

       /**

        * METHOD TO CHECK CARDS IS Skip OR ELSE

        * @return SKIP

        */

       public boolean isSkip(){return(card == SKIP);}

       /**

        * METHOD TO CHECK CARDS IS Reverse OR ELSE

        * @return REVERSE

        */

0 0
Add a comment Improve this question Transcribed image text
Answer #1

code has fixed and modified

public class UNOGame {

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

Scanner input=new Scanner(System.in);

Scanner input2=new Scanner(System.in);

UNOCard c=new UNOCard ();

UNOCard D=new UNOCard ();

Queue Q=new Queue();

listplayer ll=new listplayer();

  

System.out.println("Enter Players Name :\n Click STOP To Start Game..");

  

String Name = input.nextLine();

ll.addplayer(new player(Name));

  

while(true){

ll.addplayer(new player(Name));

Name = input.nextLine();

if(Name.equalsIgnoreCase("STOP"))

break;

}

ll.DisplayPlayer();

c.StartCard();

c.HANDCARD();

System.out.println("Enter Card Number\n");

int Number = input2.nextInt();

  

  

  

D.push(new Card(Number));

D.getTop();

  

  

ll.Win();

Q.addlast(new Queue (Name));

  

D.push(new Card(Number));

  

c.Win();

ll.addplayer(Name);

Q.addlast(Name);

  

  

}

}

public class UNOCard {

Scanner input=new Scanner(System.in);

private static final int min=-1;

private static final int max=14;

  

private int card;

private int color;

  

private Card TOP;

private int VALUE=card+color;

private int size;

int x=2;

public static final int RED =-1;

public static final int GREEN = -2;

public static final int BLUE = -3;

public static final int YELLOW = -4;

public static final int NULL = -5;

public static final int REVERSE = 10;

public static final int SKIP = 11;

public static final int DRAW_TWO = 12;

public static final int WILD = 13;

public static final int WILD_FOUR = 14;

public UNOCard(){}

/**

* CONSTRACTOR THAT TAKE TOW PARAMETERS

* @param color TO DEFINE CARD COLOR

* @param card TO DEFINE CARD TYPE

*/

public UNOCard(int color, int card)

{

this.card = card;

this.color = color;

  

TOP=null;

size=0;

if (card == WILD || card == WILD_FOUR) {

this.color = NULL;

}

}

/**

* GETTER FOR CARD COLOR

* @return color

*/

if (card == WILD || card == WILD_FOUR) {

this.color = NULL;

}

}

/**

* GETTER FOR CARD COLOR

* @return color

*/

public int getColor(){return color;}

/**

* GETTER FOR CARD VALUE

* @return card

*/

public int getVaLue(){return VALUE;}

/**

* METHOD TO CHECK CARDS IS NUMBER OR ELSE

* @return NUMBER

*/

public boolean isNumber(){return(card >= 0 && card < 10);}

/**

* METHOD TO CHECK CARDS IS Skip OR ELSE

* @return SKIP

*/

public boolean isSkip(){return(card == SKIP);}

/**

* METHOD TO CHECK CARDS IS Reverse OR ELSE

* @return REVERSE

*/

Add a comment
Know the answer?
Add Answer to:
in java coorect this code & screenshoot your output ---------------------------------------------------------------------- public class UNOGame {     /**...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • package cards; import java.util.ArrayList; import java.util.Scanner; public class GamePlay { static int counter = 0; private...

    package cards; import java.util.ArrayList; import java.util.Scanner; public class GamePlay { static int counter = 0; private static int cardNumber[] = {1,2,3,4,5,6,7,8,9,10,11,12,13}; private static char suitName[] = { 'c', 'd', 'h', 's' }; public static void main(String[] args) throws CardException, DeckException, HandException { Scanner kb = new Scanner(System.in); System.out.println("How many Players? "); int numHands = kb.nextInt(); int cards = 0; if (numHands > 0) { cards = 52 / numHands; System.out.println("Each player gets " + cards + " cards\n"); } else...

  • Need help writing Java code for this question. CircleFrame class is provided below. what happen after...

    Need help writing Java code for this question. CircleFrame class is provided below. what happen after u add the code and follow the requirement? It would be nice to be able to directly tell the model to go into wait mode in the same way that the model's notify method is called. (i.e. notify is called directly on the model, whereas wait is called indirectly through the suspended attribute.) Try altering the the actionPerformed method of the SliderListener innner class...

  • Identify a logical error in the following code and fix it. public class test1 {    ...

    Identify a logical error in the following code and fix it. public class test1 {     public static void main(String[] args){         int total;         float avg;         int a, b, c;         a=10;         b=5;         c=2;         total=a+b+c;         avg=total/3;         System.out.println("Average: "+avg);     } } Answer: Write the output of the program below. import java.util.Scanner; public class test2 { public static void main(String[] arg){ int psid; String name; Scanner input=new Scanner(System.in); System.out.println("Enter your PSID"); psid=input.nextInt(); System.out.println("Enter your...

  • Why does my program generate [] when viewing all guests names? ----------------------------------------------- import java.util.*; public class...

    Why does my program generate [] when viewing all guests names? ----------------------------------------------- import java.util.*; public class Delete extends Info { String name; int Id; int del; public Delete() { } public void display() { Scanner key = new Scanner(System.in); System.out.println("Input Customer Name: "); name = key.nextLine(); System.out.println("Enter ID Number: "); Id = key.nextInt(); System.out.println("Would you like to Delete? Enter 1 for yes or 2 for no. "); del = key.nextInt(); if (del == 1) { int flag = 0; //learned...

  • Using the following Java Class.... public class MicroWave { // Represent possible microwave heat selections private...

    Using the following Java Class.... public class MicroWave { // Represent possible microwave heat selections private final int LOW = 1; private final int MEDIUM = 2; private final int HIGH = 3;    // specifies the microwave heat selection(default is MEDIUM) private int heatSelection;    // specifies whether the microwave is on private boolean on;    private String color;    public MicroWave(int heatSelection, boolean on, String color) { this.heatSelection = heatSelection; this.on = on; this.color = color; }   ...

  • In the class GraphAlgorithm, insert java code for the method prim public class MyGraph { public...

    In the class GraphAlgorithm, insert java code for the method prim public class MyGraph { public static final int MAXSIZE = 100; public static final double BIGM = 10000000; public MyGraph(int size) { n = size; nodeStart = new Edge[MAXSIZE]; for (int i=0; i<n; i++) { nodeStart[i] = null; } } public int getSize() { return n; } public double getCost(int i, int j) { double value = BIGM; Edge e = nodeStart[i]; while (e !=null) { if (e.dest ==...

  • I need a java flowchart for the following code: import java.util.*; public class Main {   ...

    I need a java flowchart for the following code: import java.util.*; public class Main {    public static void main(String[] args) {    Scanner sc=new Scanner(System.in);           System.out.print("Enter the input size: ");        int n=sc.nextInt();        int arr[]=new int[n];        System.out.print("Enter the sequence: ");        for(int i=0;i<n;i++)        arr[i]=sc.nextInt();        if(isConsecutiveFour(arr))        {        System.out.print("yes the array contain consecutive number:");        for(int i=0;i<n;i++)        System.out.print(arr[i]+" ");       ...

  • Given the following classes: StringTools.java: public class StringTools { public static String reverse(String s){ char[] original=s.toCharArray();...

    Given the following classes: StringTools.java: public class StringTools { public static String reverse(String s){ char[] original=s.toCharArray(); char[] reverse = new char[original.length]; for(int i =0; i<s.length(); i++){ reverse[i] = original[original.length-1-i]; } return new String(reverse); } /**  * Takes in a string containing a first, middle and last name in that order.  * For example Amith Mamidi Reddy to A. M. Reddy.  * If there are not three words in the string then the method will return null  * @param name in...

  • need help with code it won't compile. import java.util.ArrayList; /** * Counts the ranks of cards...

    need help with code it won't compile. import java.util.ArrayList; /** * Counts the ranks of cards in a hand. * * @author (your name) * @version (a version number or a date) */ public class CountRank { // instance variables - replace the example below with your own private int rankCount[]; private Hand hand; private int count; /** * Constructor for objects of class CountRank */ public CountRank(Hand h) { // initialise instance variables hand = h; rankCount = new...

  • Implement the missing methods in java! Thanks! import java.util.Iterator; import java.util.NoSuchElementException; public class HashTableOpenAddressing<K, V> implements...

    Implement the missing methods in java! Thanks! import java.util.Iterator; import java.util.NoSuchElementException; public class HashTableOpenAddressing<K, V> implements DictionaryInterface<K, V> { private int numEntries; private static final int DEFAULT_CAPACITY = 5; private static final int MAX_CAPACITY = 10000; private TableEntry<K, V>[] table; private double loadFactor; private static final double DEFAULT_LOAD_FACTOR = 0.75; public HashTableOpenAddressing() { this(DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR); } public HashTableOpenAddressing(int initialCapacity, double loadFactorIn) { numEntries = 0; if (loadFactorIn <= 0 || initialCapacity <= 0) { throw new IllegalArgumentException("Initial capacity and load...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT