Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

Carey Brown

Saloon Keeper
+ Follow
since Nov 19, 2001
Carey likes ...
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
Forum Moderator
Colorado, USA
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carey Brown

Well, right there you can see one good reason not to extend a JFrame.

Now, what is the relationship between Staff and Account. It could be either of:
Staff IS-AN Account (inheritance)
Staff HAS-AN Account (aggregation)

Aggregation would not need to extend the class.
3 hours ago

Jaredson Fetiza wrote:This is the instructions for the task if it helps.
Create a student database program that stores student records, which consist of:
Student ID
Full name
Year enrolled

This is EXACTLY the way the design for a Student object would be specified. Any other way to deal with that would be tortuous and send me off into the woods screaming. I'm sorry, but with wording like this in the instructions I believe they are telling you to create a Student object.
2 days ago
What do you think? Have you tried it?
4 days ago

I used metadata for a project that was a code generator. You'd first build your database and then you'd pass that to the generator that, using "show" and "describe", would generate a complete set of Java source code for interacting with it. It was a cool project and I've used it to generate code for several other projects.

All the Types had a 1-1 relationship to Java types except one, and that was "Date". In Java that could be an "sql.Date", a "LocalDateTime", or a "Duration".
Your transcribed formula does not exactly match the one in the screen shot.

There are methods in the Math class that can help you.

What have you done so far?
6 days ago
...which got me to thinking. Why are you inserting a new row for the total at all, that could just be a transient step in the report generation process.
What if you did it with two SQL calls instead of one. The first to add the two columns and put the result in the total column. The second step to sum  the total column and insert a new record. Of course if you want to run step two another time you'd have to delete the total record at the end first.
My concept is that the "Car" is the hub of communication between various pieces which are accessed indirectly through parent.getEngine().someEngineMethod() for example.
1 week ago
For the "password" I would not have expected you to use hashmap.containsValue(...) as the hashmap may contain duplicate values or the person my have inadvertently entered someone else's password. I expected to see hashmap.get( userename ) somewhere.
1 week ago

Carey Brown wrote:This is all it takes for aggregation:
You could create a constructor that would initialize the otherClassReference but it isn't required.

When you say this to yourself it goes:
"ThisClass has-a OtherClass"
1 week ago

I haven't been following everything here but if these three thing need to talk to each other and they're all member variables then they should just be able so say "engine.someMethod()" and similar. [on second thought you might have to pass engine to trasmission]

Note two things:  get rid of "static" in front of these and use the Main framework I just mentioned, then  comb your code for places where you may have created a second instance of engine or a local variable engine (for example).
1 week ago

Ray Gilbert wrote:I just tried this:

This style of programming is non-object oriented and is perpetuating a mess. You shouldn't need static methods unless they are just utilities that don't act on the program's objects.

This is a simple framework to follow:
1 week ago
This is what I meant by creating a doAdd() method:
Then from your menu you call doAdd() and check to see if it returns false;

Note that you needed to call KEYBOARD.nextLine() not next() if you want entries that can contain spaces.

Also see note about throwing away pending new-line, this fixes a Scanner idiosyncrasy where nextInt() leave an unwanted character on the input stream.
1 week ago
This should be broken apart into two pieces: the printing loop, and a Book.toString() method.

1 week ago