English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I need u to help me wright or u wright a program in java that will play the game of uno. Any help or sources. And if in a array i want 1 row as strings and the other as int, How do i do it?

2006-10-09 02:35:25 · 6 answers · asked by JJ 1 in Computers & Internet Programming & Design

6 answers

Best bet would be to set up a data class and create an array of that type. Here is an example using public data members, which you can directly access. Alternatively, str and num could be made private, and then you would create get and set methods for accessing the data. The latter being the preferred method.

class DataSet
{
public String str;
public int num;
public DataSet()
{
str = new String();
num = 0;
}
}

public class Main
{
public static void main(String args[])
{
DataSet data = new DataSet[100];
data[0].str = "string ...";
data[0].num = "3215";
}
}

2006-10-09 08:12:03 · answer #1 · answered by Josh Falter 3 · 0 0

Search the net for tutorials - there are loads out there just waiting to be read!

As for the array - I don't know Java well, but if it's like other languages you will need to do this in two steps: First, define a type (or structure, whatever Java calls them) that contains an integer and a string. Then declare your array to be an array of that type. Each element in the array will then contain both an integer and a string.

Rawlyn.

2006-10-09 02:46:12 · answer #2 · answered by Anonymous · 0 0

I don't think we can have an array with one row is string and other is int.
To do what you wanted, you might want to have 2 array one for string and one for int. Keep the index consistent so string can referent to the int.
The best feature in java is object oriented. It's best when you declare a class with 2 members string and int.
Create an array of those objects then you have an array of string and int.

2006-10-09 02:53:19 · answer #3 · answered by vnRock 2 · 0 0

First of all you need this link.

Next you need to understand about designing and writing Java programs.
Java is OO (Object Oriented) and as such you do not have an array of strings and an array of integers.
What you have is a Card class.
Then you create an array of Cards which may or may not be another class.

You will also need to create a class for your players.
Bring it all together along with a graphic interface to display the cards and you have written your program.

2006-10-09 04:21:25 · answer #4 · answered by AnalProgrammer 7 · 0 0

You should try the java forums at http://forum.java.sun.com/index.jspa They have a large variety of different tools, and you can look to see if anyone has asked for similar help.

Note: If you are going to ask a question there, make sure that you do a little more research and ask for help with a part of the question. They won't write the program for you, but they are willing to help you out along the way.

2006-10-09 02:41:56 · answer #5 · answered by Drakokat 3 · 0 0

I have no idea what uno is, so can't help there. As for the array question, have an array of objects, and you mean element, not row.

2006-10-09 02:44:11 · answer #6 · answered by Anonymous · 0 0

fedest.com, questions and answers