/*****************************************************************************
******************************CU Organizer************************************
******************************May 1999*************************************
***********************Brian Morgan and Rhett Dillingham**********************
*****************************************************************************/
import java.awt.*;
import java.io.*;
import java.util.*;
import javax.comm.*;
// § alt - 789
// ô alt - 147
// Used to handle Contact information in one compact object with
// helper functions for retrieval of appropriately sized
// data
class Contact {
public String FirstName,LastName; // First and Last name of present contact
public String Address1,Address2; // Two lines of contacts address
public String Phone1,Phone2,Phone3; // Contacts phone number
public String temp1,temp2;
public static int MaxChar = 20; // Maximum number of characters per line
// constructor that takes all the values
public Contact(String FN, String LN, String Add1, String Add2, String PH1,
String PH2, String PH3){
FirstName = FN;
LastName = LN;
Address1 = Add1;
Address2 = Add2;
Phone1 = PH1;
Phone2 = PH2;
Phone3 = PH3;
}
// empty constructor that fills everything with blank strings
public Contact() {
FirstName = " ";
LastName = " ";
Address1 = " ";
Address2 = " ";
Phone1 = " ";
Phone2 = " ";
Phone3 = " ";
}
// get name firstname,lastname
public String getNameLF() {
temp1 = LastName + "," + FirstName;
if (FirstName.length() + LastName.length() + 1 <= MaxChar)
return temp1;
temp2 = "";
for (int i=0; i " + b + "compare: " + b.compareTo(a));
if (b.compareTo(a) < 0) {
temp = new Memo();
temp = myMemo[i];
myMemo[i] = new Memo();
myMemo[i] = myMemo[i+1];
myMemo[i+1] = new Memo();
myMemo[i+1] = temp;
}
}
}
}
// sort the contacts by last name using bubble sort
private void SortContact (){
Contact temp = new Contact();
for (int pass = 1; pass < ContactCount; pass++) {
for (int i=0; i < ContactCount-1; i++) {
String a = myContact[i].getLastName();
String b = myContact[i+1].getLastName();
//System.out.println(a + " --> " + b + "compare: " + b.compareTo(a));
if (b.compareTo(a) < 0) {
temp = new Contact();
temp = myContact[i];
myContact[i] = new Contact();
myContact[i] = myContact[i+1];
myContact[i+1] = new Contact();
myContact[i+1] = temp;
}
}
}
}
// method to write data to the currently open comm port
// output stream
private void printinfo (String s) {
char a;
String s1="";
try {
for (int i=0; i