• Post Reply Bookmark Topic Watch Topic
  • New Topic

hello,who can help me!!!!!!!!!!!!!!!!!!!!!  RSS feed

zhou xuguang
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a question:

First of all write the code for a Customer class.
It will need features for the name, title, etc.
These should all be declared as private.
you will need methods for returning there features and a constructor
which will take as an parameter list all the detaild read from the file.
You will also need methods to add and subtract from their account. Save this file as Customer.java.

Next consider the databse class. How you store the data is up to you,
consider an array or a list and look up on sun.java.com web site how to use these classes.
You will need features to construct the database(these will of course only be one),
how to add a customer to the database, how to search the database for a custoner's name,
balance and title and how to rewrite the database to file at the end of the day.
This file will be called Database.java.

Again you must consider security and code hiding.

The next task is to write a Queue.class. You will need to consider storage, adding to the back,
getting info from the front person, removing the front person, etc.

Finally you should write the Store class which will contain the main method and run the program.
This will need to read the database, construct Customer objects and add them to the Database object.
It will then read the transaction file one piece at atime, reporting on the state of the queue or transaction.
It will update the queue for each action, and update customer's records where necessary.
When the file is finished and the queue is empty it will report "Closing time" and rewrite the database.

there is some difficult to solve this question for me . help me please!!!
thanks a lot!!!
Ernest Friedman-Hill
author and iconoclast
Posts: 24217
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Welcome to JavaRanch!

We don't like to people's homework for them here at the Ranch. What we like to do is help them figure out how to do it themselves.

So your first step ought to be to create all the classes named here, and make sure you can compile them from .java files into .class file. Then pick one -- probably the Customer class -- and start fleshing it out. Work in small increments by coding a little, then compiling and testing a little. Once the Customer class does what it needs to do, move on to the next class.

At any time, if you need specific help, feel free to ask for it by replying to this same thread. We Ranchers are a friendly bunch and we're glad to help you learn.

Now, this isn't really an I/O question, it's just a beginner's Java question, so I'm going to move this to the Java in General (Beginner) forum. Followups should go there, please.
Jeff Bosch
Ranch Hand
Posts: 805
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have everything you need to get started right there in your requirements. Remember, a class consists of two things, what it has (data members) and what it does (method members). Start outlining each class along with its possible members and you'll start to see how this thing should be solved.

As Ernest said, we don't do people's homework for them, but we're here if you find you have more specific questions.

Good luck.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!