import java.awt.*;
import hsa.Console;
import java.io.*;
import java.text.*;
import java.util.Random;
public class speeddial
/*
*Module 12 Assignment
*July 20 2011
*Question Number 2
*/
{
static Console c = new Console ();
public static void main (String[] args)
{
int choice;
do
{
//MENU
c.print("Main Menu");
c.print("\n1. Enter Speed Dial Data");
c.print("\n2. Speed Dial Search");
c.print("\n3. Exit Program\n");
c.print("Please enter a choice (1-3)\n");
choice = c.readInt();
if ((choice < 1) || (choice > 3))
c.print ("\nPlease choose a number between 1-3 only");
if (choice == 1) option1();
if (choice == 2) option2();
if (choice == 3) option3();
}
while (choice != 4);
}
//Option 1
public static void option1()
{
String name[] = new String [10];
c.println("\nEnter Speed Dial Data\n");
c.print("Enter names for speed dial in the order you would like them to be in (0-9)\n");
for (int i = 0; i < 10 ; i++)
{
name[i] = c.readLine();
c.print("Please enter the next name");
c.print("\n");
}
c.print("\n");
}
//Option 2
public static void option2()
{
c.print("Search Speed Dial Names\n");
c.print("The name you have selected for speed dial number 0 is " + name[0] + "\n");
}
//Option 3
public static void option3()
{
c.print("\nThank You for using Speed Dial.\n\n");
}
}