GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes hello,who can help me!!!!!!!!!!!!!!!!!!!!! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "hello,who can help me!!!!!!!!!!!!!!!!!!!!!" Watch "hello,who can help me!!!!!!!!!!!!!!!!!!!!!" New topic
Author

hello,who can help me!!!!!!!!!!!!!!!!!!!!!

zhou xuguang
Greenhorn

Joined: Nov 18, 2004
Posts: 2
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
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Hi,

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.


[Jess in Action][AskingGoodQuestions]
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 805
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.


Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
 
GeeCON Prague 2014
 
subject: hello,who can help me!!!!!!!!!!!!!!!!!!!!!