java problem

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Sep 2004
Posts: 24
Reputation: PeterX is an unknown quantity at this point 
Solved Threads: 0
PeterX PeterX is offline Offline
Newbie Poster

java problem

 
0
  #1
Oct 11th, 2004
I have a litle problem
please help me whit:
I want to write a methode whit one paramter.
public int studentInformation(int hour){//How long time(hour) he was at school.
- - - - - - --- - - - - -
- - - - - - - - - - - - --
return ;

}
Now I want that the same information(above method) uses for every student.
How can I call it for every student.
How do I write code?
// first I want call it for student1
// then for student2, student3.........
and how do I print it out.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 2
Reputation: CAVEMANDAN is an unknown quantity at this point 
Solved Threads: 0
CAVEMANDAN CAVEMANDAN is offline Offline
Newbie Poster

Re: java problem

 
0
  #2
Oct 12th, 2004
Originally Posted by PeterX
I have a litle problem
please help me whit:
I want to write a methode whit one paramter.
public int studentInformation(int hour){//How long time(hour) he was at school.
- - - - - - --- - - - - -
- - - - - - - - - - - - --
return ;

}
Now I want that the same information(above method) uses for every student.
How can I call it for every student.
How do I write code?
// first I want call it for student1
// then for student2, student3.........
and how do I print it out.

If you need to store information on students (which all follows the same format) and then print it out again you may be better off creating an array.

If you want a number of objects (i.e. each a different student, each holding variables) you would have to creat a student class where the student class would have a method called studentInformation. You would then have a method called printStudentInformation in the same class to print out the information held by this student. In the main, you would create a student and give that student variables. You will be able to create a number of students.

I have a program which i think the architechter is similar, which involves a car class holding information on cars and a method within lets you change or print the information held on each car.

If you want to mail me for any help on this my e-mail is couldridd@aol.com

Dan
Reply With Quote Quick reply to this message  
Join Date: Jan 2006
Posts: 3
Reputation: swapnil_gadkari is an unknown quantity at this point 
Solved Threads: 0
swapnil_gadkari swapnil_gadkari is offline Offline
Newbie Poster

Re: java problem

 
0
  #3
Jan 7th, 2006
according to me for this u need to create object for student i.e. s and then access the objects by calling them.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC