6.40 LAB: Contact list A contact list is a place where you can store a specific...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
6.40 LAB: Contact list A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings), separated by a comma. That list is followed by a name, and your program should output the phone number associated with that name. Output "None" if name is not found. Assume that the list will always contain less than 20 word pairs. Ex: If the input is: 3 Joe, 123-5432 Linda, 983-4123 Frank, 867-5309 Frank the output is: 867-5309 Your program must define and call the following method. The return value of getPhoneNumber() is the phone number associated with the specific contact name. public static String getPhone Number (String[] nameArr, String[] phoneNumberArr, String contactName, int arraySize) Hint: Use two arrays: One for the string names, and the other for the string phone numbers. 480462.3568798.qx3zqy7 import java.util.Scanner; public class LabProgram { /* Define your method here */ public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int size scnr.nextInt(); string[] name = new String[size]; String[] number = new String[size]; String[] str = new String[size]; String temp char c; = ; int i; int j; for (i=0; i < size; ++i) { str[i] scnr.next(); for (j=0; j < str[i].length(); ++j) { C = str[i].charAt(j); if (Character.isLetter(c) temp += c; == true) { } } } name[i] = temp; System.out.println(name[i]); for (i=0; i < size; ++i) { str[i] scnr.next(); for (j = 0; j < str[i].length(); ++j) { C = str[i].charAt(j); if (Character.isDigit(c) == true || c == '') { temp += c; } } number[i] = temp; 6.40 LAB: Contact list A contact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. Write a program that first takes as input an integer N that represents the number of word pairs in the list to follow. Word pairs consist of a name and a phone number (both strings), separated by a comma. That list is followed by a name, and your program should output the phone number associated with that name. Output "None" if name is not found. Assume that the list will always contain less than 20 word pairs. Ex: If the input is: 3 Joe, 123-5432 Linda, 983-4123 Frank, 867-5309 Frank the output is: 867-5309 Your program must define and call the following method. The return value of getPhoneNumber() is the phone number associated with the specific contact name. public static String getPhone Number (String[] nameArr, String[] phoneNumberArr, String contactName, int arraySize) Hint: Use two arrays: One for the string names, and the other for the string phone numbers. 480462.3568798.qx3zqy7 import java.util.Scanner; public class LabProgram { /* Define your method here */ public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int size scnr.nextInt(); string[] name = new String[size]; String[] number = new String[size]; String[] str = new String[size]; String temp char c; = ; int i; int j; for (i=0; i < size; ++i) { str[i] scnr.next(); for (j=0; j < str[i].length(); ++j) { C = str[i].charAt(j); if (Character.isLetter(c) temp += c; == true) { } } } name[i] = temp; System.out.println(name[i]); for (i=0; i < size; ++i) { str[i] scnr.next(); for (j = 0; j < str[i].length(); ++j) { C = str[i].charAt(j); if (Character.isDigit(c) == true || c == '') { temp += c; } } number[i] = temp;
Expert Answer:
Related Book For
Management Leading And Collaborating In The Competitive World
ISBN: 9780078137242
9th Edition
Authors: Thomas Bateman, Scott Snell
Posted Date:
Students also viewed these programming questions
-
(a) Consider two clusters A and B each hosting multiple applications. All applications send bursty traffic between A and B over a link E. Under what conditions is circuit switching more efficient to...
-
answer the question clearly You are building a flight-control system for which a convincing safety case must be made. Would you assign the tasks of safety requirements engineering, test case...
-
Product Strategy Duff has always followed a level production strategy because Duff prefers not to fire and hire employees. Management is open to change if there is enough of a cost benefit for the...
-
1. Based on this information, do you believe Publishers Clearing House has committed fraud? 2. Why or why not? Publishers Clearing House agreed to pay $34 million in a deal with 26 states to settle...
-
The unadjusted trial balance at April 30, 2021, and adjustment data for the month of April 2021 for Garden Designs are presented below: Additional information: 1. $500 of the unearned revenue is to...
-
Steven Sanchez worked as a warehouse employee for Gruma Corporation. In December 2016, Sanchez was presented an arbitration agreement during a meeting with George Tate, the human resources manager...
-
Exhibit 3.36 presents a statement of cash flows for Starbucks for 2006, 2007, and 2008. This statement is an expanded version of the statement of cash flows for Starbucks shown in Exhibit 1.28....
-
Scenario 17:Accountant 17 is the former manager of the audit dept. She says: when covid hit I decidedto retire. I was a cpa for 30 years but im no longer practicing, can I still call myself a cpa? Do...
-
1. CREATE JOURNAL ENTRIES FOR THE APRIL 2023 TRANSACTIONS BELOW FOR SUNFLOWER DESIGNS: a: On April 1, $350 of office supplies were purchased on credit; the terms of the invoice were net 30. All of...
-
What does the "cost of product/service for customers" include in terms of customer value?
-
1. Convert to base 2: 12510: 236478: 149210: 532438: 2A316: EE28116:
-
Discuss a company's life cycle in terms of "green or clean investing". What are the different forms of green investments? What are the "risks" in green investments?
-
Solve each equation by factoring. 1) (k+1)(k-5)=0
-
There is a $1000 credit memo on the bank statement. This is for a note receivable collected by the bank on behalf of the company. The note is for customer A. Tolbert and is $900 principle plus $100...
-
6. Write down the dual program of the following linear program. There is no need to provide intermediate steps. max(x3x2 + 4x3 - x4) subject to 1-2-3x3-1 x2 + 3x3 5 X3 1 X1, X2, X3, X4 20
-
Write a paper about medication error system 2016.
-
When Irene Rosenfeld unveiled her turnaround plan, she knew Kraft would need to win back customers both at home and abroad. To concentrate on the companys core brands, Rosenfeld sold off Minute Rice,...
-
What are the pros and cons of bureaucratic controls such as rules, procedures, supervision, and the like?
-
As CEO of a floundering company, Anne Mulcahy had to make hard choices. She closed divisions, eliminated 34,000 jobs, and trimmed billions in expenses. Mulcahy believes companies in crisis need...
-
Write a program in \(\mathrm{R}\) that generates \(b\) samples of size \(n\) from a specified distribution \(F\). For each sample compute the statistic \(Z_{n}=n^{1 / 2}...
-
Write a program in \(\mathrm{R}\) that generates \(b\) samples of size \(n\) from a \(\mathbf{N}\left(\mathbf{0}, \boldsymbol{\Sigma}_{n}ight)\) distribution where...
-
Using a probability theory argument, show that the sum of all elements of any covariance matrix is non-negative.
Study smarter with the SolutionInn App