// The "Phonebook" class.
import java.awt.*;
import hsa.Console;
public class Phonebook
{
static Console c; // The output console
public static void main (String[] args)
{
c = new Console ();
//ARRAYS
String Names[];
Names = new String [31];
String Address[];
Address = new String [31];
String CellNum[];
CellNum = new String [31];
String Num[];
Num = new String [31];
String Email[];
Email = new String [31];
String Comment[];
Comment = new String [31];
//VARS
int command;
int arraynum;
String YN;
int iextra;
iextra = 1;
//Program
for (int p = 1 ; p <= 30 ; p = p + 1)
{
Names [p] = "Empty";
} //endfor
c.println ("Welcome to Buddy Lister v.01b");
c.println ("The Following are commands To use your Buddy Lister.");
c.println ("1 -adds a buddy, 2 -Deletes a Buddy, 3 -Change Buddies Info \n 4 -Views a buddies info. 5 -Opens help.");
while (true)
{
c.print ("Enter Command: ");
command = c.readInt ();
if (command == 10)
break;
switch (command)
{
case 1:
c.clear ();
c.println ("Enter Phone ID To Enter New Buddy Into: ");
arraynum = c.readInt ();
c.println ("Add Buddies name: ");
Names [arraynum] = c.readLine ();
c.println ("Add Buddies E-mail address: ");
Email [arraynum] = c.readLine ();
c.println ("Add Buddies Phone Number: ");
Num [arraynum] = c.readLine ();
c.println ("Add Buddies Cell Phone Number: ");
CellNum [arraynum] = c.readLine ();
c.println ("Add A Buddies Address: ");
Address [arraynum] = c.readLine ();
c.println ("Add A Comment for Buddy: ");
Comment [arraynum] = c.readLine ();
c.println ();
break;
case 2:
c.clear ();
c.println ("Enter Buddies Phone ID to Delete: ");
arraynum = c.readInt ();
c.println ("Are you sure you want to Delete: ");
c.println (Names [arraynum]);
c.println (Email [arraynum]);
c.println (Num [arraynum]);
c.println (CellNum [arraynum]);
c.println (Address [arraynum]);
c.println (Comment [arraynum]);
c.println ();
c.println ("Y / N");
YN = c.readString ();
if (YN == "Y" | YN == "y")
{
Names [arraynum] = "Empty";
Email [arraynum] = "Empty";
Num [arraynum] = "Empty";
CellNum [arraynum] = "Empty";
Comment [arraynum] = "Empty";
Address [arraynum] = "Empty";
}
else
{
c.print ("");
}
break;
case 3:
c.clear ();
c.println ("Enter Buddies Phone ID To Change: ");
arraynum = c.readInt ();
c.println ("Enter Buddies New Name: ");
Names [arraynum] = c.readLine ();
c.println ("Enter Buddies New E-mail Address: ");
Email [arraynum] = c.readLine ();
c.println ("Enter Buddies New Phone Number: ");
Num [arraynum] = c.readLine ();
c.println ("Enter Buddies New Cell Phone Number: ");
c.println ("Enter Buddies New Address: ");
Address [arraynum] = c.readLine ();
c.println ("Enter A New Comment For Buddy: ");
Comment [arraynum] = c.readLine ();
break;
case 4:
c.clear ();
c.println ("Enter Phone ID to View: ");
arraynum = c.readInt ();
c.println ("Phone ID : " + arraynum);
c.println ("Name : " + Names [arraynum]);
c.println ("E-mail : " + Email [arraynum]);
c.println ("Phone Number : " + Num [arraynum]);
c.println ("Cell Phone Number : " + CellNum [arraynum]);
c.println ("Address : " + Address [arraynum]);
c.println ("Comment : " + Comment [arraynum]);
break;
case 5:
c.clear ();
for (int i = 1 ; i <= 30 ; i = i + 1)
{
c.println ("ID: " + i + " Name: " + Names [i]);
} //endfor
case 6:
c.clear ();
c.println ("1 -adds a buddy, 2 -Deletes a Buddy, 3 -Change Buddies Info \n 4 -Views a buddies info.5 -Opens Directory. 6 -Opens help.");
c.println ("");
c.println ("Any bugs or problems found Contact
Ph34revolved@hotmail.com. Or \n on IRC: SERVER: Gamesurge, Channel: #ikonz. PM Ephekt.");
break;
}
}
} // main method
} // Phonebook class