Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need assistance writing code. Using Dr. Java. Keep getting compiler errors. Unsure what I am doing wrong. Instructions and Plan are below. l Promot This

Need assistance writing code. Using Dr. Java. Keep getting compiler errors. Unsure what I am doing wrong. Instructions and Plan are below.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

l Promot This primes the sentinelloop control variable before entering the loop. Begin entering addresses? Y' or 'N fthe answer is Y, go to prompt 2 and continue with the other prompts; otherwise, print "Exiting PROGRAM INSTRUCTIONS: To create a program that creates an address book. a. Use a while loop to process multiple addresses. Use a sentinel-controlled loop variable b. Use if-else, nested if-else andif structures to figure out whether program 2nd Prompt This is the owner of the address book. Enter your name: i. to capture the name for the owner of the address book or print the message Exiting program." ll. the address is for family or friend ii to print the address book Use Dntto with format specifiers where needed. Don't forget to insert the exit statement at the end of rmain(f C. Promot Enter the name of the addressee: uaPromor where therepresent the addressee's name Enter the street for Xxxxxxxxxxxx: d. The promots the s and the samnle a you in what order to place your code. To return from these links press Alt then left arroww 2, Develop (pseudocode) your plan tirsLThe plan is worth 10% of your grade. a. The prompts tell you what input variables you willneed. b. The output will tell you the type of calculations you will need (ifany) and whether you will need to declare additional variables c. The output will tell you the order of logic for your code d. Save your plan as YourLastNameFirstlnitialSecNoPA1Plan. Download the plan Protnor-where the represent the addressee's name Enter the city, state and zip code for XXXXXXXXXXX in the correct format: instructions and the plan template through the links posted for this assignment on Blackboard Enter the phone number for XXXXXXXXXXX including area code: In the variable deciaration area, youW have to code a variable for the phone number as a String, A String is immutable, cannot be changed, therefore, you'l give the String to a StringBuilder object that'l allow for editing as follows: 3. Work and submit this program on your own (no partner). Name your program as urSectionNoPA1 StringBuilder phoneFormatted a. In your program, YOU MUST insert a program purpose in the first comment box. The content of that first comment box was shown to you in the Anatomy of a Java Program lecture for chapter 1 Right after you capture the phone number you' use the StringBuiider object to insert dashes into your phone number. Here's the code b. Use Javadoc comment boxes beginning with and ending withIfor your comment C. Insert a Javadoc comment box above your methods explaining what is going on in the d. Line comment the import statements and the variables declared at the class level and/or //SENDING THE PHONE NUMBER N THE STRING VARIABLE phone TO THE //STRNGBUILDER OBJECT. /THE DASHES INTO THE PHONE NUMBER phoneFormattednew StringBuilder (phone) pheneEesmatted.insert(3 boxes THEN USING THAT OBJECT TO INSERT method that goes for the maing which is a method in any method [including main0] 5. Eormaing Rules: Refer to the Java Style Guide PDF posted on Blackboard in IS 2033 t Prompt Because you're categorizing the addresses as either family or friend, you'll need to store Always test your output to validate that your program is functioning properly with the correct output and spacing them in 2 separate String variabies (objects) Relationship of addressee: 1. Family PROMPIS: Code the bold from the prompts below in the gratt statements that capture data into your program. Once again, the prompts tell you your input variables 2. Friends Choose from the above: Code the String variables (objects) where you declare all your variables. string family String.fornatnAMn + "egCLEX, State Zip: %s" "4nPhone : %sta", addressee, + street, /END if relationship not equal 1 Promot This alters the sentinel loop control variable toeither continue with another address or exit the loop REPEAT THE STRING DECLARATION FOR FRIENDS /THIS IP-ELSE DETERMINES IN WHICH STRING OBJECT TO STORE THE ADDRESS Do you want to enter another address? 'Y or 'N: WHERE SHOULD YOU PLACE THIS IP-ELSE? WHEN YOU TEST relationship irrelationship 1) EINAL QUTPUL SPECIEICATIONS: The outout will print the header, address category, addressee's name, street, city, state, zip code, and phone number. The specifications are repeated because there can be muitiple addresses. The s represent the name of the owner of the address book, the addressee, the street, city, capitalized abbreviation for the state, zip code, and phone number t 8pity State Zip:8 t8n Phone in, addressee, street, ADDRESS BOOK FOR XXXXXXXXX:XXX FAMILY Addressee:Xxxxxxxxxxxx City, State Zip: XxxxxxxxX, XX xx3xx Header (Titley Triple -line advance header title using 2 "96n" with 1 %n at the end ofthe litoral. Use 1 96n"at the beginning of the znd header line and 1 at the end. All copital ameans the name is to be in all CAPS /END if relationship equals 1 else Street: Phone: xxx-xxx-xxxx Addressee: Xxxxxxxxxxxx. City, State Zip: Xxxxxxxxxx, XX xxxxx Phone: xxx-xxx-xxxx FRIENDS Addressee XXXXXXXXXXX City, State Zip Xxxxxxxxxx. xxzxxx Phone: xxx-xxx-xxxx City, state Zip: Xxxxxxxxxx, XX xxxxx Phone: xxx-xxx-x3x3 END OF OUTPUT SPECIFICATIONS Plan for PA1 Method main) Data another: char 1. Program Purpose: This program creates an address book. Members name, addressee, street, city StateZip, phone, family friends: String Input another name addressee street citystatezip Processin Output phoneFormatted: StrineBuilder relationship: int input: Scanner ADDRESS BOOK FOR XXXXXXXXXXXX FAMILY Methods +main(String) args): static void phone relationship Addressee: XxxIIxxxxiii Street: XxnaxxxxixxX City. State Zip: XxIIiiiiL, XX xxxx, Phone: xxx-xxx-xxx) 3. Program Logic im Scanner Street: XTIIXXMIAIXX City. State Zip: Kxii. XX xxxI Phone: xxx--ax Class Header: public class FRIENDS Class Variables (Fields): Refer to the Class Data Members section of the class Addressee: XxxIIxxxxxxI ram for a list of class-level variables or fields which should s be N/A City, State Zip:xxxxxxxxX, XX xxxxx Phone: xxx-IxK METHOD LOGIC TABLE RECOPY FOR EACH METHOD IN YOUR PROGRAM. Method Purpose: User asked to create an address book. If no, the program exits with an exit message; otherwise, If yes, the program proceeds to capturing the user's name, addressee's name, address, and phone number. The information is stored in a String object specific to whether the addressee is family or friend. After an entry for an addressee is complete, the user is prompted to continue with another address or not. If the user doesn't want to continue,then the address book is printed Method Header pubic static void Method Variables City, State Zip:Xxxxxxxxix, XX xxxxx Phone: xxx-IxIE 2. Class Diagram trin ar anot Class Name string name, addressee, street phone tring familyFEANS LTNE ADVANCE BLANK LINE MEANS LINE ADVANCE Class NA FAMILY" Data Members string friends = FRIENDS StringBui1der phoneFormatted int relationship U Scanner input Addressee, addressee Street strect City, State CODE Phone ", Prompts Input Variables Input Prompt "Begin entering addresses? 'Y' or another 2 name 3 addressee 4 street Algorithms Prompt1 if another'Y (another) Enter your name: Prompt2 "Enter the name of the addressee else Enter the street for, ressee, Prompt 1 "Enter the city, state, and zip code for "ad while another'Y dressee. " in the correct Prompt3 Prompt 4 Prompt5 Prompt 6 format 6 phone "Enter the phone number for, addressee "Relationship of addressee:" 1 Family" 7 relationship tted new StringBuilder (phone) "2. Friend" "Choose from the above" 'Do you want to enter another address? 8 another Prompt 7 if relationship 1 if(relationship1) Calculations Formulas family += //BLANK LINE MEANS LINE ADVANCE N/A Addressee: addressee eet:, street "City, State Zip, Phone:" Print BLANK LINE MEANS LINE ADVANCE Exiting program. friends += //BLANK LINE MEANS LINE ADVANCE ADDRESS BOOK FOR ALL CAPS) FAMILY endIf Prompt8 Addressee addressee Street", street City, State Zip "sitStatezip Phone if another not equal Y' Print 2 endwbile STOP l Promot This primes the sentinelloop control variable before entering the loop. Begin entering addresses? Y' or 'N fthe answer is Y, go to prompt 2 and continue with the other prompts; otherwise, print "Exiting PROGRAM INSTRUCTIONS: To create a program that creates an address book. a. Use a while loop to process multiple addresses. Use a sentinel-controlled loop variable b. Use if-else, nested if-else andif structures to figure out whether program 2nd Prompt This is the owner of the address book. Enter your name: i. to capture the name for the owner of the address book or print the message Exiting program." ll. the address is for family or friend ii to print the address book Use Dntto with format specifiers where needed. Don't forget to insert the exit statement at the end of rmain(f C. Promot Enter the name of the addressee: uaPromor where therepresent the addressee's name Enter the street for Xxxxxxxxxxxx: d. The promots the s and the samnle a you in what order to place your code. To return from these links press Alt then left arroww 2, Develop (pseudocode) your plan tirsLThe plan is worth 10% of your grade. a. The prompts tell you what input variables you willneed. b. The output will tell you the type of calculations you will need (ifany) and whether you will need to declare additional variables c. The output will tell you the order of logic for your code d. Save your plan as YourLastNameFirstlnitialSecNoPA1Plan. Download the plan Protnor-where the represent the addressee's name Enter the city, state and zip code for XXXXXXXXXXX in the correct format: instructions and the plan template through the links posted for this assignment on Blackboard Enter the phone number for XXXXXXXXXXX including area code: In the variable deciaration area, youW have to code a variable for the phone number as a String, A String is immutable, cannot be changed, therefore, you'l give the String to a StringBuilder object that'l allow for editing as follows: 3. Work and submit this program on your own (no partner). Name your program as urSectionNoPA1 StringBuilder phoneFormatted a. In your program, YOU MUST insert a program purpose in the first comment box. The content of that first comment box was shown to you in the Anatomy of a Java Program lecture for chapter 1 Right after you capture the phone number you' use the StringBuiider object to insert dashes into your phone number. Here's the code b. Use Javadoc comment boxes beginning with and ending withIfor your comment C. Insert a Javadoc comment box above your methods explaining what is going on in the d. Line comment the import statements and the variables declared at the class level and/or //SENDING THE PHONE NUMBER N THE STRING VARIABLE phone TO THE //STRNGBUILDER OBJECT. /THE DASHES INTO THE PHONE NUMBER phoneFormattednew StringBuilder (phone) pheneEesmatted.insert(3 boxes THEN USING THAT OBJECT TO INSERT method that goes for the maing which is a method in any method [including main0] 5. Eormaing Rules: Refer to the Java Style Guide PDF posted on Blackboard in IS 2033 t Prompt Because you're categorizing the addresses as either family or friend, you'll need to store Always test your output to validate that your program is functioning properly with the correct output and spacing them in 2 separate String variabies (objects) Relationship of addressee: 1. Family PROMPIS: Code the bold from the prompts below in the gratt statements that capture data into your program. Once again, the prompts tell you your input variables 2. Friends Choose from the above: Code the String variables (objects) where you declare all your variables. string family String.fornatnAMn + "egCLEX, State Zip: %s" "4nPhone : %sta", addressee, + street, /END if relationship not equal 1 Promot This alters the sentinel loop control variable toeither continue with another address or exit the loop REPEAT THE STRING DECLARATION FOR FRIENDS /THIS IP-ELSE DETERMINES IN WHICH STRING OBJECT TO STORE THE ADDRESS Do you want to enter another address? 'Y or 'N: WHERE SHOULD YOU PLACE THIS IP-ELSE? WHEN YOU TEST relationship irrelationship 1) EINAL QUTPUL SPECIEICATIONS: The outout will print the header, address category, addressee's name, street, city, state, zip code, and phone number. The specifications are repeated because there can be muitiple addresses. The s represent the name of the owner of the address book, the addressee, the street, city, capitalized abbreviation for the state, zip code, and phone number t 8pity State Zip:8 t8n Phone in, addressee, street, ADDRESS BOOK FOR XXXXXXXXX:XXX FAMILY Addressee:Xxxxxxxxxxxx City, State Zip: XxxxxxxxX, XX xx3xx Header (Titley Triple -line advance header title using 2 "96n" with 1 %n at the end ofthe litoral. Use 1 96n"at the beginning of the znd header line and 1 at the end. All copital ameans the name is to be in all CAPS /END if relationship equals 1 else Street: Phone: xxx-xxx-xxxx Addressee: Xxxxxxxxxxxx. City, State Zip: Xxxxxxxxxx, XX xxxxx Phone: xxx-xxx-xxxx FRIENDS Addressee XXXXXXXXXXX City, State Zip Xxxxxxxxxx. xxzxxx Phone: xxx-xxx-xxxx City, state Zip: Xxxxxxxxxx, XX xxxxx Phone: xxx-xxx-x3x3 END OF OUTPUT SPECIFICATIONS Plan for PA1 Method main) Data another: char 1. Program Purpose: This program creates an address book. Members name, addressee, street, city StateZip, phone, family friends: String Input another name addressee street citystatezip Processin Output phoneFormatted: StrineBuilder relationship: int input: Scanner ADDRESS BOOK FOR XXXXXXXXXXXX FAMILY Methods +main(String) args): static void phone relationship Addressee: XxxIIxxxxiii Street: XxnaxxxxixxX City. State Zip: XxIIiiiiL, XX xxxx, Phone: xxx-xxx-xxx) 3. Program Logic im Scanner Street: XTIIXXMIAIXX City. State Zip: Kxii. XX xxxI Phone: xxx--ax Class Header: public class FRIENDS Class Variables (Fields): Refer to the Class Data Members section of the class Addressee: XxxIIxxxxxxI ram for a list of class-level variables or fields which should s be N/A City, State Zip:xxxxxxxxX, XX xxxxx Phone: xxx-IxK METHOD LOGIC TABLE RECOPY FOR EACH METHOD IN YOUR PROGRAM. Method Purpose: User asked to create an address book. If no, the program exits with an exit message; otherwise, If yes, the program proceeds to capturing the user's name, addressee's name, address, and phone number. The information is stored in a String object specific to whether the addressee is family or friend. After an entry for an addressee is complete, the user is prompted to continue with another address or not. If the user doesn't want to continue,then the address book is printed Method Header pubic static void Method Variables City, State Zip:Xxxxxxxxix, XX xxxxx Phone: xxx-IxIE 2. Class Diagram trin ar anot Class Name string name, addressee, street phone tring familyFEANS LTNE ADVANCE BLANK LINE MEANS LINE ADVANCE Class NA FAMILY" Data Members string friends = FRIENDS StringBui1der phoneFormatted int relationship U Scanner input Addressee, addressee Street strect City, State CODE Phone ", Prompts Input Variables Input Prompt "Begin entering addresses? 'Y' or another 2 name 3 addressee 4 street Algorithms Prompt1 if another'Y (another) Enter your name: Prompt2 "Enter the name of the addressee else Enter the street for, ressee, Prompt 1 "Enter the city, state, and zip code for "ad while another'Y dressee. " in the correct Prompt3 Prompt 4 Prompt5 Prompt 6 format 6 phone "Enter the phone number for, addressee "Relationship of addressee:" 1 Family" 7 relationship tted new StringBuilder (phone) "2. Friend" "Choose from the above" 'Do you want to enter another address? 8 another Prompt 7 if relationship 1 if(relationship1) Calculations Formulas family += //BLANK LINE MEANS LINE ADVANCE N/A Addressee: addressee eet:, street "City, State Zip, Phone:" Print BLANK LINE MEANS LINE ADVANCE Exiting program. friends += //BLANK LINE MEANS LINE ADVANCE ADDRESS BOOK FOR ALL CAPS) FAMILY endIf Prompt8 Addressee addressee Street", street City, State Zip "sitStatezip Phone if another not equal Y' Print 2 endwbile STOP

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

=+What is the brand's character or personality?

Answered: 1 week ago