• Post Reply Bookmark Topic Watch Topic
  • New Topic

Help with Project  RSS feed

Amber Hisaw
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class project due in two weeks. Programming does not come easy to me, so I am needing some help with this. The following are the requirements for the project:

Create a BlueJ project that maintains a student, faculty and staff directory. Your project should be able to add new entries, update entries and print the entries alphabetically by name. In addition, you should be able to remove an entry or print an entry given the entry name.

Assume the entries have the following fields:

All Persons
First name
Last name
Email address
Class (e.g. freshman, sophmore, junior, senior)
Title (e.g. Mr., Ms.)
Tenured (Boolean)
The directory should contain these methods:

Add person
Print all people (alphabetically by name)
Print just Students
Remove a person
Retrieve a person

You should develop an hierarchical class structure that minimizes duplication among the classes. Each class should overload the toString() method to produce an appropriate String to be used as the directory listing. The listing should be produced by iterating through the Collection of entries, using the toString() method to print each entry. Since you want to display the directory alphabetically, you might consider using a Tree Map Collection to store your database, creating the key by concatenating the last and first name. To facilitate implementation of the remove and retrieve methods, add a getter method to the Person class to return the key of the object.

Any suggestions for this would be greatly appreciated. Thanks!
fred rosenberger
lowercase baba
Posts: 12563
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should read our StopCoding FAQ. It has lots of good tips on what to do when you start a project (short version: turn off your computer, turn on your brain).

Next, when you do get to writing code, write teeny, tiny pieces. compile about 200 times more often than you think you should. test a LOT, each and every time you compile. Isolate components. don't do too much at once.

for example, EVERY SINGLE TIME I start a project, I write this much, and no more, before I compile the first time:

I would prefer to write less, but that is really about the minimum I can write to see it do something.

I will write tons of code I throw away. I'm a big fan of System.out.println(S.o.p.). I put S.o.p in everywhere. Entering methods, leaving methods, at the top of each loop, print out exit conditions...my code will be littered with them, and i add/remove them frequently.

I always try to write as little as possible to advance towards my goals. My first go at any new method would do no more than have a S.o.p saying "i'm in the method". the next step might be to add parameters to it, and print them out in the method. Then I might start manipulating them.

a simple method to say add all the ints in an array would probably have a dozen iterations of me writing it, adding a piece at a time.
Scott Winterbourne
Ranch Hand
Posts: 116
Eclipse IDE Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest not doing any coding right now and focusing on design. It's best to really understand the problem and break it down into smaller more manageable chunks. See the StopCoding page for some helpful information on how to do this. [EDIT] Fred beat me to the punch with this suggestion

First off you'll probably want to design your classes and hierarchy. It looks like there are 3 people classes (Student, Staff, and Faculty). These all have shared attributes (First Name, Last Name, and Email Address) which can be put into a parent class called Person. Then Student, Staff, and Faculty can inherit (extend) from the parent Person class.

Try writing out the class, the instance variable, and methods on paper for each and then where you see some duplication, see if it would make sense to create a parent class to hold those variables or methods and then the child classes can inherit from the parent class.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!