aspose file tools*
The moose likes Java in General and the fly likes help creating mutator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "help creating mutator" Watch "help creating mutator" New topic
Author

help creating mutator

Kamran Khaen
Greenhorn

Joined: Jan 16, 2010
Posts: 15
the task is

add a method signUp()which will allow a student to sign up for the race meeting. When a student signs up for the meeting, their achievements points are incremented by the attendance points of the race meeting, they are added to the team and the cost for the meeting is added to the contest's total costs. Seniors pay £10, juniors pay half of the costs, matures pay the full cost.

my meeting class is




any my student class is




anyone think they can crack it kinda stuck and dont know wher to begin

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

What's a mutator ?


Seriously, you'll have to tell us concretely what your problem is, not just write your assignement like that. Remember that the ranch is NotACodeMill. If there are many problems, break them into small problems.

1. Where do you add the signUp method ? What's its parameters ?
2. Increment the student's achievement points
3. Add the student to the team
4. Increase contest's total costs (value depends on the age of the student)


[My Blog]
All roads lead to JavaRanch
Kamran Khaen
Greenhorn

Joined: Jan 16, 2010
Posts: 15
i add the the mutator to the meeting class, im jus confused on how to do what is asked. im not asking you to rite the code for me. could you please write and example and explain the method which in contrast to what im asking.

im confused on the points 234 above

not so sure on how to do these

2. Increment the student's achievement points
3. Add the student to the team
4. Increase contest's total costs (value depends on the age of the student)
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

2. Increment the student's achievement points

There's a method called incrementPoints in the Student class.
Kamran Khaen
Greenhorn

Joined: Jan 16, 2010
Posts: 15
Christophe Verré wrote:
2. Increment the student's achievement points

There's a method called incrementPoints in the Student class.



ok I figured out that I do a method call, but how do I add the student to the team
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

The Meeting class holds a team variable, which is an ArrayList of Student. If you pass the Student to the signUp method, you should be able to add the student to the team.
Kamran Khaen
Greenhorn

Joined: Jan 16, 2010
Posts: 15
ok bessically, ive just gone back and found an error, i have to create a method to allow a student to signup for the race meeting, this is the first thing i need to do

i have another class called Society which has created an arraylist for meeting the class is posted below



do I use this array list to add the student to the race meeting
>
Kamran Khaen
Greenhorn

Joined: Jan 16, 2010
Posts: 15
to add a student i used this code but its giving an error
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

do I use this array list to add the student to the race meeting

Not that one. You use the ArrayList of the Meeting class. Try to think logically from here. Tell yourself "how do I add a Student to the ArrayList of the Meeting class ?" From there, you should figure out that you need a method in the Meeting class to add Students.
Kamran Khaen
Greenhorn

Joined: Jan 16, 2010
Posts: 15
ok this is the code ive used for the signup method it worked anyone know if its correct

Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

It looks good. Maybe you'll have to check that the Student is not already in the team.
However, the totalCost is being reinitialized every time you add a Student. You'll have to fix this.
Kamran Khaen
Greenhorn

Joined: Jan 16, 2010
Posts: 15
Christophe Verré wrote:It looks good. Maybe you'll have to check that the Student is not already in the team.
However, the totalCost is being reinitialized every time you add a Student. You'll have to fix this.


how do i fix it?, do I put this. infront of it?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

1. There's a isSignedUp method in the Meeting class that you can use
2. About totalCost, do you know how to add a value to another value ?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: help creating mutator