public class Activity { String name =""; public Activity(String name) { this.name = name; } public String getName() { return name; } }
I'm trying to create methods used in a module called GymBase which are below:
public class GymBase implements IGymBase { String act; /** * Add an activity to the database. * @param activity The name of the activity to add. */[/color] public void addActivity(String activity) { Activity act = new Activity("activity"); } /** * Get the number of activities in the database. * @return Number of activities in the database. */[/color] public int getNbrActivities() { return 0; } /** * Get the i'th activity in the database. * @param i Index of the activity (indices start at 0). * @return The name of the activity. */[/color] public String getActivity(int i) { return act.getName(i); } /**
So far I have put in the methods for getActivity and addActivity, but neither are working...Can anyone point me in the right direction? There are other parts of the database such as a GUI and Main.java, however they are created in a way which means i don't need to edit them.
Any help is appreciated.
Thanks