Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class HansonJ002PA2
- {
- public static void main(String [] args)
- {
- char another = ' ';// to collect additional input
- String name = "";// collects users name
- String addressee = "";// collects the name of the addressee
- String street = "";// collects street of addressee
- String cityStateZip = "";// collects cityStateZip of address
- String phone = "";// collects the phone number of addressee
- String family = String.format("%nFAMILY%n");// lists addressee as family
- String friends = String.format("%nFRIENDS%n");// lists addressee as friend
- String work = String.format("%nWORK%n");// lists addressee as work
- String personal = String.format("%nPERSONAL%n");// sets address as personal
- String business = String.format("%nBUSINESS%n");// sets address as business
- String addressbook = String.format("%nADDRESSBOOK%n");
- StringBuilder phoneFormatted;// collects the format used while inputing the phone number
- int relationship = 0;// collects the input of the relationship between user and addressee
- int bookType;
- char correct = ' ';
- Scanner input = new Scanner(System.in);
- System.out.printf("%nBegin entering addresses? \'Y\' or \'N\' ");
- another = input.nextLine().charAt(0);
- if(Character.toUpperCase(another) != 'Y')
- {
- System.out.printf("%nExiting Program%n");
- }
- while(Character.toUpperCase(another) == 'Y')
- {
- do
- {
- System.out.printf("Address Book Type\n 1. Personal\n 2. Buisness\nChoose from above the address book type:");
- bookType = input.nextInt();
- input.nextLine();
- switch(bookType)
- {
- case 1: System.out.printf("%nYou entered 1. for Personal. Is this correct? 'Y' or 'N' ");
- correct = input.nextLine().charAt(0);
- break;
- case 2: System.out.printf("%nYou entered 2. for Business. Is this correct? 'Y' or 'N' ");
- correct = input.nextLine().charAt(0);
- break;
- }
- if(bookType != 1 && bookType != 2 )
- {
- System.out.printf("%nYou entered %d which is the wrong address book type. Try again. ", bookType);
- correct = 'N';
- input.nextLine();
- }
- }while(Character.toUpperCase(correct) == 'N');
- do
- {
- System.out.printf("%nEnter your name: ");
- name = input.nextLine();// Captures name of addressbook owner
- System.out.printf("%nYou entered %s. Is this correct? 'Y' or 'N': ",name);
- correct = input.nextLine().charAt(0);
- name += String.format(addressbook);
- }
- while(Character.toUpperCase(correct) == 'N'); //Name validation
- do
- {
- System.out.printf("%nEnter the name of the addressee: ");
- addressee = input.nextLine();// Captures addressee name
- System.out.printf("%nYou entered %s. Is this correct? 'Y' or 'N': ",addressee);
- correct = input.nextLine().charAt(0);
- /*
- do
- {
- }while();//Addresse validation
- do
- {
- }while();//Street address validation
- do
- {
- }while();//City State Zip validation
- do
- {
- }while();//Phone Number validation
- do
- {
- switch(relationship)
- {
- }
- }while();//Relationship validation
- switch(relationship)
- {
- }
- }while();
- switch(bookType)
- {
- }//Print addressbook as personal or business
- */
- System.out.printf("%nWant to create another address book? \'Y\' or \'N\' ");
- another = input.nextLine().charAt(0);
- }while(Character.toUpperCase(correct) == 'Y');
- }
- }//END main()
- }//END APPLICATION CLASS HansonJ002PA2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement