Results 1 to 10 of 10
- 02-19-2009, 03:35 AM #1
Member
- Join Date
- Feb 2009
- Posts
- 32
- Rep Power
- 0
Need a simple and efficient solution.
Ok heres what i have:
Just with a lot more than a, b, and c.
Java Code:public int a; public int b; public int c; add(Math.random(3)); public void add(int i) { switch (i) { case 1: a += 1; break; case 2: b += 1; break; case 3: c += 1; break; } }
I was told something like an ArrayList and I looked into it but it was very confusing and there were no examples..
Thanks for help anyone!
- 02-19-2009, 01:50 PM #2
huh?
Sam... a simple and efficient solution to do what ? All you said was a, b, c and arraylist. I think that even you don't know what needs to be done. I don't know you're level of Java knowledge, but I would suggest you understanding arrays first. Here's a link to a tutorial:
Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics)
Luck,
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 02-19-2009, 02:14 PM #3
Yes, you only get specific answers from specific questions. Asking us to do something for you is bad enough. It isn't even possible to help when you tell us to do something but you don't say what.
-MK12Tell me if you want a cool Java logo avatar like mine and I'll make you one.
- 02-19-2009, 07:42 PM #4
Member
- Join Date
- Feb 2009
- Posts
- 32
- Rep Power
- 0
can you not see the code?
- 02-19-2009, 11:15 PM #5
Sam... our purpose is not to aggravate or upset the people who ask questions on the forum. If two people tell you that they don't understand the question or problem, then they really don't understand what you need. You haven't explained it. What do you need your program to do?
I will tell you what I see:
- A call to an add() method.
- An add() method that switchs on the argument that is passed to it and will add a 1 to a variable depending on the passed argument. This method returns nothing.
I really don't understand where the arraylist fits in this picture.
Do you want to save the results in an arraylist?
Luck,
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 02-19-2009, 11:36 PM #6
Member
- Join Date
- Feb 2009
- Posts
- 32
- Rep Power
- 0
yes instead of having
public int a;
public int b;
public int c;
- 02-19-2009, 11:58 PM #7
Sam.. I've sent a private message... lets see if we can figure this out in Spanish.
Luck,
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
- 02-20-2009, 12:19 AM #8
Member
- Join Date
- Feb 2009
- Posts
- 32
- Rep Power
- 0
Hablo Inglés .. Yo sólo soy nuevo en java ..
- 02-20-2009, 12:22 AM #9
Member
- Join Date
- Feb 2009
- Posts
- 32
- Rep Power
- 0
Creo que necesito para usar un HashMap
- 02-20-2009, 01:18 AM #10
Ta bueno.. but we have to speak English in the forum. Just tell us what is it that you want to do?
- What data do you want to store?
- How do you want to store it?
- How do you want to retreive the stored data?
- What is the data going to be used for?
CJSLChris S.
Difficult? This is Mission Impossible, not Mission Difficult. Difficult should be easy.
Similar Threads
-
Efficient Perfect Number
By Lite3864 in forum New To JavaReplies: 4Last Post: 11-23-2008, 01:07 AM -
More efficient in memory? Multiple Jars or Single Jars with lot's of Classes
By dark_cybernetics in forum New To JavaReplies: 0Last Post: 08-19-2008, 04:44 PM -
How to write efficient maintainable code.
By Zosden in forum Advanced JavaReplies: 9Last Post: 05-01-2008, 04:48 AM -
Simple serverless chat solution
By goodjonx in forum NetworkingReplies: 3Last Post: 01-07-2008, 03:25 PM
Bookmarks