Keith Rainey
OCPJP6
Steve
Katie Johns wrote:So far I have it so that the user enters a number that corresponds with their choice.
Joanne
Joanne
Joanne Neal wrote:There are a number of ways to ask a user for input and the next step will depend on how you've done it.
So show us what you have so far and we can then make some suggestions for how to continue.
Keith Rainey wrote:
Okay... which parts do you understand and not understand?
1) get user entry from console
2) compare entry to valid possibilities
3) do/while loop
4) store info in array
5) output details for each round
If you break it down into its component pieces of logic, it's not that daunting. At least you can identify the parts you understand and which you need to work on.
Katie Johns wrote:Currently, I have an if/else statement that compares the users input of 0,1, or 2 with the random number of the computer to determine the winner. I have been trying to fool around with making yourInput a string but so far I get errors that you can't have int data type and string to compare them.
Keith Rainey
OCPJP6
Katie Johns wrote:I am new to arrays. From what I understand, an array has a set length defined on creation. My array has 100 elements(?). How would I store the input from the user and computer in an array and call that to output the details/
Keith Rainey
OCPJP6
Keith Rainey wrote:Do you understand how to access the elements of arrays to set and retrieve values?
I have used single arrays that are really small, everything was already set and I just retrieve the values from the position in the array. The two dimensional array is confusing to me. Will the user's input be stored into the array as the program runs?
Like as the user keeps playing after every game will it store the value in the array?
Keith Rainey
OCPJP6
Katie Johns wrote:I can't figure out how to get a multidimensional array to work for printing out the results from the games the user played. :/
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
fred rosenberger wrote:Is your problem with setting up the array, with writing to it, or with reading from it?
Keith Rainey wrote:... if (userInputStringValue=="rock" ) ...
SCJP
Visit my download page
Sorry, I was really busy yesterday, so I didn’t have a chance to read these posts. Fred pointed it out better than I would havefred rosenberger wrote: . . . Someone (campbell...cough...cough...cough) is bound to point out at any moment . . .
Katie Johns wrote:...what's scaring me the most, is I have to use a multi-dimensional array to store the user's choices and the computer's choices for each round...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
fred rosenberger wrote:... you have created what I think of as an empty egg carton that can hold up to 10 eggs, but each spot is empty until you buy the egg.
Space seems cool in the movies, but once you get out there, it is super boring. Now for a fascinating tiny ad:
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
|