Hello Sir/Madam, could you please help me for the code to write UNO CARD GAME using following elements using JAVA Language:
1. Use of at least three Abstract Data Types 2. Use of inheritance and polymorphism 3. Use of recursion 4. Connection and use of a simple database 5. At least one sorting algorithm 6. At least one search algorithm 7. Use of a graphical user interface. Thank you in advance!
Code to implement UNO in Java
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
public class PopulatingDeck {
private static Map<Long,String> map;
private static Map<String,Integer> mapDeck;
private static ArrayList <String> finalDeck;
private static boolean cardShow= false;
private static String checkCardKey;
private static boolean MapContainsValueFlag= false;
private static String cardValueRecieved;
public PopulatingDeck(){
map=new HashMap<Long,String>();
finalDeck=new ArrayList<String>();
mapDeck=new HashMap<String,Integer>();
map.put(new Long(0), "blue");
map.put(new Long(1), "green");
map.put(new Long(2), "yellow");
map.put(new Long(3), "red");
generateDeck();
}
public static void main(String[] args) {
// TODO Aut#o-generated method stub#
System.out.println("hiiiiiiiii");
PopulatingDeck generatingDeck=new PopulatingDeck();
for(int i=0;i<finalDeck.size();i++){
System.out.println(finalDeck.get(i)+" \n");
}
}
private static String randomColorGeneration(){
long temp=Math.round(Math.random()*3);
if(map.containsKey(temp)){
return map.get(temp);
}
else{
return null;
}
}
public static void generateDeck(){
for(int i=0;finalDeck.size()<108;i++){
cardShow=cardDisplayCheck();
if (cardShow)
finalDeck.add(checkCardKey);
}
}
public static String randCardNumber() {
String returnString;
Random rand = new Random();
int randomNum = rand.nextInt(15);
if(randomNum>=10 && randomNum<15){
switch(randomNum){
case 10: return "+2";
case 11: return "Skip";
case 12: return "Reverse";
case 13: return "WildCard-Farbe";
case 14: return "WildCard- +4";package pavan.uno;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
public class PopulatingDeck {
private static Map<Long,String> map;
private static Map<String,Integer> mapDeck;
private static ArrayList <String> finalDeck;
private static boolean cardShow= false;
private static String checkCardKey;
private static boolean MapContainsValueFlag= false;
private static String cardValueRecieved;
public PopulatingDeck(){
map=new HashMap<Long,String>();
finalDeck=new ArrayList<String>();
mapDeck=new HashMap<String,Integer>();
map.put(new Long(0), "blue");
map.put(new Long(1), "green");
map.put(new Long(2), "yellow");
map.put(new Long(3), "red");
generateDeck();
}
public static void main(String[] args) {
// TODO Aut#o-generated method stub#
System.out.println("hiiiiiiiii");
PopulatingDeck generatingDeck=new PopulatingDeck();
for(int i=0;i<finalDeck.size();i++){
System.out.println(finalDeck.get(i)+" \n");
}
}
private static String randomColorGeneration(){
long temp=Math.round(Math.random()*3);
if(map.containsKey(temp)){
return map.get(temp);
}
else{
return null;
}
}
public static void generateDeck(){
for(int i=0;finalDeck.size()<108;i++){
cardShow=cardDisplayCheck();
if (cardShow)
finalDeck.add(checkCardKey);
}
}
public static String randCardNumber() {
String returnString;
Random rand = new Random();
int randomNum = rand.nextInt(15);
if(randomNum>=10 && randomNum<15){
switch(randomNum){
case 10: return "+2";
case 11: return "Skip";
case 12: return "Reverse";
case 13: return "WildCard-Farbe";
case 14: return "WildCard- +4";
}
}
else{
returnString=String.valueOf(randomNum);
return returnString;
}
return null;
}
public static boolean cardDisplayCheck(){
String localCardNumberDisplay=randCardNumber();
if(!localCardNumberDisplay.startsWith("W")){
checkCardKey=localCardNumberDisplay+" - " +randomColorGeneration();
}
else{
checkCardKey=localCardNumberDisplay;
}
int cardCounter=0;
if(!MapContainsValueFlag||!mapDeck.containsKey(checkCardKey)){
mapDeck.put(checkCardKey, ++cardCounter);
MapContainsValueFlag=true;
return true;
}
if(checkCardKey.startsWith("0") && mapDeck.containsKey(checkCardKey)){
return false;
}
if(checkCardKey.startsWith("W") && mapDeck.containsKey(checkCardKey)&& mapDeck.get(checkCardKey)<4){
mapDeck.put(checkCardKey, mapDeck.get(checkCardKey)+1);
return true;
}
if(mapDeck.containsKey(checkCardKey)){
if(mapDeck.get(checkCardKey)<2){
mapDeck.put(checkCardKey, mapDeck.get(checkCardKey)+1);
return true;
}
}
return false;
}
}
}
}
else{
returnString=String.valueOf(randomNum);
return returnString;
}
return null;
}
public static boolean cardDisplayCheck(){
String localCardNumberDisplay=randCardNumber();
if(!localCardNumberDisplay.startsWith("W")){
checkCardKey=localCardNumberDisplay+" - " +randomColorGeneration();
}
else{
checkCardKey=localCardNumberDisplay;
}
int cardCounter=0;
if(!MapContainsValueFlag||!mapDeck.containsKey(checkCardKey)){
mapDeck.put(checkCardKey, ++cardCounter);
MapContainsValueFlag=true;
return true;
}
if(checkCardKey.startsWith("0") && mapDeck.containsKey(checkCardKey)){
return false;
}
if(checkCardKey.startsWith("W") && mapDeck.containsKey(checkCardKey)&& mapDeck.get(checkCardKey)<4){
mapDeck.put(checkCardKey, mapDeck.get(checkCardKey)+1);
return true;
}
if(mapDeck.containsKey(checkCardKey)){
if(mapDeck.get(checkCardKey)<2){
mapDeck.put(checkCardKey, mapDeck.get(checkCardKey)+1);
return true;
}
}
return false;
}
}
Hello Sir/Madam, could you please help me for the code to write UNO CARD GAME using...
Write ONE application program by using the following requirements: Using JAVA File input and output Exception handling Inheritance At least one superclass or abstract superclass: this class needs to have data members, accessor, mutator, and toString methods At least one subclass: this class also needs to have data members, accessor, mutator, and toString methods At least one interface: this interface needs to have at least two abstract methods At least one method overloading At least one method overriding At least...
2. Activity Directions: Create a UML diagram and then write the code for the object classes needed for your UNO game. You will need a minimum of three classes: a. A Card class (models an individual UNO card) b. A Hand class (models a player's hand) c. A Deck class (models the entire UNO deck) You may add other classes as you see fit. Test your program by writing a console application (a driver program) that creates a deck of...
Can someone please help with this in JAVA? Write one application program by using the following requirements: 1) Exception handling 2) Inheritance a) At least one superclass or abstract superclass: this class needs to have data members, accessor, mutator, and toString methods b) At least one subclass: this class also needs to have data members, accessor, mutator, and toString methods c) At least one interface: this interface needs to have at least two abstract methods d) At least one method...
Game Development: Uno For this assignment you will be creating the game of Uno (See the accompanying pdf for the instructions of the game). Your version will adhere to all the rules except that only the next player can issue a challenge against the previous player in regards to penalties, and your games must have at least three (3) players and at most nine (9) players. To begin, you must create the class Card which contains: Private string field named...
Need help extending and constructing this problem in JAVA using the given guidelines. public class gatorade { public void nutrition() { System.out.println("nutrition facts method"); System.out.println("90 Calories"); System.out.println("0 Grams Fat"); System.out.println("20 MG Sodium"); System.out.println("18 Grams Sugar"); System.out.println("0 Grams Protein"); } } //inheritance public class blueberry extends gatorade{ System.out.println("Color is blue"); public class orange extends gatorade{ System.out.println("Color is orange"); public class lemonlime extends gatorade{ System.out.println("Color is yellow"); public class fruitpunch extends gatorade{ System.out.println("Color is red"); ________________________________________________________ Write one application program by using...
Create a simplified Blackjack game using the Deck and Card classes (download the attached files to start). There is also a "TestCard" class that creates a Deck and runs some simple code. You may choose to use this file to help you get started with your game program. 1) Deal 2 cards to the "player" and 2 cards to the "dealer". Print both the player's cards, print one of the dealer's cards. Print the total value of the player's hand. 2) Ask...
Program with generic merge sort and binary search
method help. The programming language I'm using is Java.
This program should show understanding generic merge sort methods and generic binary search methods in java. The execution should include at least 5 found items including one from the first three items in the sorted array and one from the last three items in the sorted array as well as at least two items not found Create a generic merge sort method that...
Hello, Could you please help me code this program in Java? It is important that all rules are carefully followed. Using the PairOfDice class from PP 4.9, design and implement a class to play a game called Pig. In this game, the user competes against the computer. On each turn, the current player rolls a pair of dice and accumulates points. The goal is to reach 100 points before your opponent does. If, on any turn, the player rolls a...
Hello I have an automata question could you help me? [1Points] Give a formal description of a Turing Machine M that takes two parameters: an integer and an array of integers and decides whether the given integer is an element of the array or not. You can assume that all the integers are between 0 and 9. The input string will be written on the tape of the Turing machine. The first square of the tape contains the integer, the...
Can you please help with the below? 1) Which of the following is true about using a 2-3-4 tree? a. It is designed to minimize node visits while keeping to an O(log n) search performance b. It is designed to self-balance as new values are inserted into the tree c. As soon as a node becomes full, it performs the split routine d. None of the above 2) Which of the following is true about a binary search tree? a. ...