Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help with trying to write a program

 
Richard Thorne
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic