my dog learned polymorphism
The moose likes Beginning Java and the fly likes need help with trying to write a program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "need help with trying to write a program" Watch "need help with trying to write a program" New topic

need help with trying to write a program

Richard Thorne

Joined: Nov 10, 2005
Posts: 1
hello. im new to this site. but i was wondering if anyone could help me... im doing a uni course in computing, and i am learning java...ive only been learning it for 5 weeks, however, i now have to do a mini project...the question i have been given is as follows...
Write a program that functions as a register for a problem class[like a class in school]. It should be possible to add and remove names, add and remove class dates, record whether a person was present at a class and display a report of who was present at a selected class. Data should be stored in a file.

can anyone please help me with any avice on how to get started, or jus any ideas....

anything will b greatly appreciated
Jody Brown
Ranch Hand

Joined: Nov 09, 2005
Posts: 43
First you should think about what data structure you might want to use for your data. Something like a Vector would suffice, or an array if you wanted a fixed number of students. A list would also work. Take a look at the collections package to see which fits your purpose best. Then, you might want to consider how you will store the details of each pupil. The fields you listed are application specific, so it would make sense that you would implement a Pupil class with fields for name, date joined etc stored in there. The data structure you should have already decided on can be used to store a collection of instances created from the Pupil class.

Once you have your data structures sorted out, you can get down to the nitty gritty of writing your application code. A ClassRegister class could hold an instance of the collection that in turn contains the pupils. You may want an addPupil method that creates an instance of a Pupil and adds it to the collection. You may want to remove an existing pupil. you may want to check which pupils joined after a particular date. These sorts of things can be written in seperate methods. These would call the data structure and use the methods provided by both the Vector/List/Array and also the getter and setter methods in your Pupil class.

I hope this goes at least some way to getting you started.
I agree. Here's the link:
subject: need help with trying to write a program
It's not a secret anymore!