Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.23 KB | None | 0 0
  1. /**
  2.  * @(#)HansonJ002PA2
  3.  * @author Hanson John
  4.  * @version 1.00 2019/3/18 3:42 PM
  5.  *
  6.  * Program Purpose: Organize Address Book into Family & Friends
  7.  */
  8.  
  9. import java.util.Scanner;
  10. public class HansonJ002PA2
  11. {
  12.   public static void main(String [] args)
  13.   {
  14.     char another = ' ';// to collect additional input
  15.     String name = "";// collects users name
  16.     String addressee = "";// collects the name of the addressee
  17.     String street = "";// collects street of addressee
  18.     String cityStateZip = "";// collects cityStateZip of address
  19.     String phone = "";// collects the phone number of addressee
  20.     String family = String.format("%nFAMILY%n");// lists addressee as family
  21.     String friends = String.format("%nFRIENDS%n");// lists addressee as friend
  22.     StringBuilder phoneFormatted;// collects the format used while inputing the phone number
  23.     int relationship = 0;// collects the input of the relationship between user and addressee
  24.     int bookType;
  25.     char correct = ' ';
  26.     Scanner input = new Scanner(System.in);
  27.    
  28.     System.out.printf("%nBegin entering addresses? \'Y\' or \'N\' ");
  29.     another = input.nextLine().charAt(0);
  30.    
  31.     if(Character.toUpperCase(another) != 'Y')
  32.     {
  33.       System.out.printf("%nExiting Program%n");
  34.     }
  35.     while(Character.toUpperCase(another) == 'Y')
  36.     {
  37.       System.out.printf("Address Book Type\n 1. Personal\n 2. Buisness\nChoose from above the address book type:");
  38.       bookType = input.nextInt();
  39.       input.nextLine();
  40.       do
  41.       {
  42.         switch(bookType)
  43.         {
  44.           case 1: System.out.printf("%nYou entered 1. for Personal. Is this correct? 'Y' or 'N' ");
  45.           correct = input.nextLine().charAt(0);
  46.            break;
  47.          
  48.           case 2: System.out.printf("%nYou entered 2. for Personal. Is this correct? 'Y' or 'N' ");
  49.           correct = input.nextLine().charAt(0);
  50.            break;
  51.         }
  52.         if(bookType != 1 && bookType != 2 )
  53.         {
  54.           System.out.printf("%nYou entered %d which is the wrong address book type. Try again. ", bookType);
  55.           correct = 'N';
  56.           input.nextLine();
  57.         }
  58.          
  59.       }while(Character.toUpperCase(correct) == 'N');
  60.        
  61.        /**do
  62.          {
  63.          
  64.          }
  65.          while(); //Booktype validation
  66.          
  67.          do
  68.          {
  69.          do
  70.          {
  71.          
  72.          }while();//Addresse validation
  73.          
  74.          do
  75.          {
  76.          
  77.          }while();//Street address validation
  78.          
  79.          do
  80.          {
  81.          
  82.          }while();//City State Zip validation
  83.          
  84.          do
  85.          {
  86.          
  87.          }while();//Phone Number validation
  88.          
  89.          do
  90.          {
  91.          switch(relationship)
  92.          {
  93.          
  94.          }
  95.          }while();//Relationship validation
  96.          
  97.          switch(relationship)
  98.          {
  99.          
  100.          }
  101.          }while();
  102.          
  103.          switch(bookType)
  104.          {
  105.          
  106.          }//Print addressbook as personal or business
  107.          
  108.         System.out.printf("%nWant to create another address book? \'Y\' or \'N\' ");
  109.       another = input.nextLine().charAt(0);
  110.       */
  111.     }//END WHILE
  112.   }//END main()
  113. }//END application class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement