import java.util.Scanner;
public class Addresses
{
public static void main (String[] args)
{
String[][] table = {
{"Bob", "1111 Main St.", "City, ", "CA ", "92840"},
{"Steve", "2000 Ave.", "Amazing City, ", "CA ", "92840"},
{"Alice", "9000 Blvd.", "Ghetto Town, ", "CA ", "92840"},
{"Retro", "12345 Disco Rd.", "Eighties, ", "CA ", "92840"},
{"Bob#2", "The Replacement St.", "Nowhere, ", "CA ", "92840"}
};
System.out.println ("0: Bob \n1: Steve \n2: Alice \n3: Retro \n4: Bob#2");
System.out.println ();
System.out.print ("Please enter the number of the person whose address you would like to print: ");
Scanner scan = new Scanner (System.in);
int print = scan.nextInt();
if (print == 0)
{
System.out.println (table[0][0]+"\n"+table[0][1]+"\n"+table[0][2]+""+table[0][3]+""+table[0][4]);
}
if (print == 1)
{
System.out.println (table[1][0]+"\n"+table[1][1]+"\n"+table[1][2]+""+table[1][3]+""+table[1][4]);
}
if (print == 2)
{
System.out.println (table[2][0]+"\n"+table[2][1]+"\n"+table[2][2]+""+table[2][3]+""+table[2][4]);
}
if (print == 3)
{
System.out.println (table[3][0]+"\n"+table[3][1]+"\n"+table[3][2]+""+table[3][3]+""+table[3][4]);
}
if (print == 4)
{
System.out.println (table[4][0]+"\n"+table[4][1]+"\n"+table[4][2]+""+table[4][3]+""+table[4][4]);
}
}
}
public class Addresses
{
public static void main (String[] args)
{
String[][] table = {
{"Bob", "1111 Main St.", "City, ", "CA ", "92840"},
{"Steve", "2000 Ave.", "Amazing City, ", "CA ", "92840"},
{"Alice", "9000 Blvd.", "Ghetto Town, ", "CA ", "92840"},
{"Retro", "12345 Disco Rd.", "Eighties, ", "CA ", "92840"},
{"Bob#2", "The Replacement St.", "Nowhere, ", "CA ", "92840"}
};
System.out.println ("0: Bob \n1: Steve \n2: Alice \n3: Retro \n4: Bob#2");
System.out.println ();
System.out.print ("Please enter the number of the person whose address you would like to print: ");
Scanner scan = new Scanner (System.in);
int print = scan.nextInt();
if (print == 0)
{
System.out.println (table[0][0]+"\n"+table[0][1]+"\n"+table[0][2]+""+table[0][3]+""+table[0][4]);
}
if (print == 1)
{
System.out.println (table[1][0]+"\n"+table[1][1]+"\n"+table[1][2]+""+table[1][3]+""+table[1][4]);
}
if (print == 2)
{
System.out.println (table[2][0]+"\n"+table[2][1]+"\n"+table[2][2]+""+table[2][3]+""+table[2][4]);
}
if (print == 3)
{
System.out.println (table[3][0]+"\n"+table[3][1]+"\n"+table[3][2]+""+table[3][3]+""+table[3][4]);
}
if (print == 4)
{
System.out.println (table[4][0]+"\n"+table[4][1]+"\n"+table[4][2]+""+table[4][3]+""+table[4][4]);
}
}
}
(0) Comments
Post a Comment