Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Lab #8-Phone Number For this assignment, create a flowchart using Flowgorithm fo

ID: 3916378 • Letter: L

Question

Lab #8-Phone Number For this assignment, create a flowchart using Flowgorithm for Programming Exercise 7 on page 336 of the textbook. This flowchart must use two parallel arrays, one for the names and the other for the numbers. The numbers array should be type string so that the phone numbers can have a format like (214) 555-1234. Use the first names of your friends or family, but the phone numbers can be phony. Remember to put the program name and your name in a comment. The output should match the example below. Test your program to make sure it works Upload: Your Flowgorithm (.fprg) file Here are examples of what the output for this program should look like. Enter a name Jane The phone number is (817) 555-6666

Explanation / Answer

Ans Given By:

import java.util.*;
public class PhoneList
{public static void main(String [] args)
     {String name[]={"Harrison, Rose","James, Jean","Smith, William","Smith, Brad" };
    String phone[]={"555-2234",      "555-9098",    "555-1785",     "555-9224"};   
    String n;
    int i;
    boolean found=false;
    Scanner in=new Scanner(System.in);
    System.out.print("enter a name or the first few characters of a name: ");
    n=in.next();
    for(i=0;i<name.length;i++)
         {if(name[i].indexOf(n)>=0)
             {System.out.println(name[i]+": "+phone[i]);
            found=true;
            }
        }
        if(!found)
           System.out.println(n+" not found in the phone list");