Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Arrays and strings

 
MaryEllen Volb
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem where the program will implement a class called 'Student'. The class will contain the student's name, ID, and status, i.e. Freshman, Sophomore,etc. Using the Math.random ()function, the program will randomly assign ID numbers to 20 students. The program will output the names and ID numbers
of all the junior students.
Since I am just learning arrays, I was hoping someone could help me with this problem. I have to assing 20 student names as Name1, Name2, and so on. Please help!!!

thanks, Mary Ellen
 
Allen Alchian
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mary Ellen
Here is a shot at what I understood you are looking for. I cheated by giving each person the same name and status, just to get data into the array. I assume you can figure out how to fix that part. Probably can use some other refinements, but this will hopefully help you understand the array issue. Hope this helps.
Allen

 
MaryEllen Volb
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much for the help.....I really need it!
Mary Ellen
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic