|
![]() |
Tracy Villa wrote:Would I do the charAt the index?
Tracy Villa wrote:
I'm sorry for asking so many questions; I am just so frustrated![]()
Tracy Villa wrote:I see....I haven't got Arrays down because I have not learned them yet, so I was wondering how to read in multiple lines into an ArrayList
Tracy Villa wrote:Ahhh excuse me, I meant multiple files into an ArrayList
....and then it will generate a random place from the file they chose.
Tracy Villa wrote:
I am stuck at how to generate the random city from the seed provided by the user. I am very confused because the files that do exist only have a few lines. But my program is supposed to be able to print out a random city, even if the seed is larger than the number of lines in the file
Tracy Villa wrote:When you say circular, it makes me think I have to use a loop. Is ArrayList still necessary for this? In my head is to use a for loop and I am trying to go about this with it
Tracy Villa wrote:Would I need to nest loops because of my multiple files?
Tracy Villa wrote:
t prompts the user for one of the three files. When they type in a file that exists, my program is supposed to then ask for a seed, and then it will use that seed to randomly select an index within the file that they chose, and the program will then print out a random city from the file.
Tracy Villa wrote:Would I need to nest loops because of my multiple files?
Tracy Villa wrote:
I'm trying to avoid using arrays and Lists because I'm uncomfortable with them
Your approach 2 is the one I'm trying to achieve.
I think I grasp the gist of what you are saying, but am still trying to completely comprehend it. Am I approaching this correctly?
Tracy Villa wrote:Oops x_x I was trying to do #B without list approach 2
Could I get a hint how to start B? If I understand correctly, I would start it similar to #A, and would be using
Tracy Villa wrote:I apologize; I would take the time to learn arrays right now but I'm a slow learner, and this project is overdue and so I am just using the most familiar method to me so I can get it over with as soon as possible >_<
I tried this
But it always has the same output, no matter what random number I put in. Did I do something wrong with my while loop?
Seriously? That's what you're going with? I prefer this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|