It's not a secret anymore!
The moose likes Beginning Java and the fly likes dialog boxes and two users Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "dialog boxes and two users" Watch "dialog boxes and two users" New topic

dialog boxes and two users

Holly Leery
Ranch Hand

Joined: Sep 08, 2004
Posts: 97
Ok below is a code i have been trying to put together. I want there to be two seprate users that as dialog boxes pop up they enter their first name then last and then their age. Each user does that and then in the end i want to compare the ages and the last dialog box to say:

First Person: Smith, John (31)
Second Person: Doe, Mike (35)
Doe is older than Smith

So here is my code and i know i have serveral errors, can someone help me?

[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ September 09, 2004: Message edited by: Dirk Schreckmann ]
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
When posting code, please be sure to surround the code with the [code] and [/code] UBB Tags. This will help to preserve the formatting of the code, thus making it easier to read and understand.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Holly Leery
Ranch Hand

Joined: Sep 08, 2004
Posts: 97
sorry about that. i didnt realize that would happen. thanks for the tip.

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

That's really not too bad. The main problem is that you're assigning the value returned from showInputDialog() directly to age1 and age2, which are integers. You'll need separate String variables to hold the String values, and pass those values to parseInt() and assign the return values of parseInt() to the ageX variables.

Make sense?

[Jess in Action][AskingGoodQuestions]
Holly Leery
Ranch Hand

Joined: Sep 08, 2004
Posts: 97
sort a little lost? so i put the dialog boxes in string variables and ages in a different variable? sorry im a little a slow at this. im new so i dont really know what everything means i have to go and look it up.
It is sorta covered in the JavaRanch Style Guide.
subject: dialog boxes and two users
It's not a secret anymore!