Originally posted by Mike Pirrone:
How in the World do I put the input the user enters into an array?
1st - Program Asks for the number of students to be entered. (I put that answer into a for loop).
2nd - Program Asks for First Name
3rd - Program Asks for Second Name
4th - Program Asks for Grade
Then with that info I sort it. I'm writing a student class that will do all of the name and grade information for me but like I said I'm having troubles putting that info into an array. any help would be greatly appreciated.
-mike-
How do you want to store this data in an array. Do you want to use a tripple subscripted array, and store the first name as a
string, the last name as a string, then the grade as a double? This is a bad idea by the way.
Or do you want to construct an Object that will hold the first name, last name, and the grade then place those objects in an array? This is probably how I would do it
Here's some sample code of how to do it the second way.
You already said that you know how to get the user input, so I won't do that.
There is some dependencies which I didn't describe like having a Student class and having a constructor for that class that takes a String,String,double. But I'm assuming that you can work with that.
Hope this helps.