Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Arrays and strings

 
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
 
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
 
Consider Paul's rocket mass heater.
    Bookmark Topic Watch Topic
  • New Topic