T
The DUDE
I am writing a problem to take some user input (firstname, lastname,
email), store the input into an array, sort the input by lastname and
then print out all the input in the following format:
abba, joe, (e-mail address removed)
smith, bob, (e-mail address removed)
Here is what I have some far, can anyone help? Any suggestions?
public class Records {
public static void main(String[] args) {
String firstname, lastname, email = null;
String[] list = new String[100];
int curPos = 0;
// quesdo code
while (still more user input) {
firstname = input1;
lastname = input2;
email = input3;
list[curPos++] = lastname + ", " + firstname + ", " + email;
}
Arrays.sort(list);
for (int i=0; i<list.length; i++) {
System.out.println(list);
}
}
}
email), store the input into an array, sort the input by lastname and
then print out all the input in the following format:
abba, joe, (e-mail address removed)
smith, bob, (e-mail address removed)
Here is what I have some far, can anyone help? Any suggestions?
public class Records {
public static void main(String[] args) {
String firstname, lastname, email = null;
String[] list = new String[100];
int curPos = 0;
// quesdo code
while (still more user input) {
firstname = input1;
lastname = input2;
email = input3;
list[curPos++] = lastname + ", " + firstname + ", " + email;
}
Arrays.sort(list);
for (int i=0; i<list.length; i++) {
System.out.println(list);
}
}
}