I need some help with the Java Array homework, it says:
 "The homework is to create the MyOwnJavaArrayProject project as
following:

    * Ask the English version of the full names (first-name last-name)
of three of your family members using showInputDialog() method of the
JOptionPane class.
    * Display the name of the family member who has the longest first
name (not the longest of the  total name) as following.  (If there is
a tie, just display one of the two.)
          o Daniel Shin has the longest first name

Hint: You will have use various methods of String class.  The
following is an example code fragment you might be able to use.
Please feel free to use alternative ways of doing the homework"

// Get the first name from a name string using split() instance (non-
static) method
String[] nameArrayForPerson1 = person1NameInstance.split(" ");
String[] nameArrayForPerson2 = person2NameInstance.split(" ");

// Get the lengths of strings using length() instance (non-static)
method
int lengthOfFirstNameOfPerson1 = nameArrayForPerson1[0].length();
int lengthOfFirstNameOfPerson2 = nameArrayForPerson2[0].length();

// Compare the lengths of the first names between person1 and person2
if (lengthOfFirstNameOfPerson1 > lengthOfFirstNameOfPerson2){
   System.out.println(nameArrayForPerson1[0] +
                              " has longer first name than " +
                              nameArrayForPerson2[0]);"


I'm relatively clueless how to do this, first off what does the .split
and the .length do after the variables? I imagine that has a key role
in making the program, if it doesn't then how do I go about making
such a program?

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to