1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
taurus [48]
3 years ago
8

In java write a program: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). That list is followed by a name, and your program should output that name's phone number. 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 Frankthe output is:867-5309Your 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 GetPhoneNumber(String[] nameVec, String[] phoneNumberVec, String contactName, int arraySize)Hint: Use two arrays: One for the string names, and the other for the string phone numbers.
Computers and Technology
1 answer:
BigorU [14]3 years ago
4 0

Answer:

import java.util.Scanner;

public class ContactInformation

{

public static String GetPhoneNumber(String[] nameVec, String[] phoneNumberVec, String contactName, int arraySize)  

{  

for(int i=0;i<arraySize;i++)

{

if(nameVec[i].equals(contactName))  

return phoneNumberVec[i];

}  

return "Contact doesn't exists!";

}

public static void main(String[] args)

{

int records;

Scanner sc = new Scanner(System.in);

System.out.print("Enter the size of contact List :");

records=sc.nextInt();

String[] contactNameList=new String[records];

String[] phoneNumberList=new String[records];

String contactName;

System.out.println("Enter the contact name and phone number :");

for(int i=0;i<contactNameList.length;i++)

{  

contactNameList[i]=sc.next();  

phoneNumberList[i]=sc.next();  

}  

System.out.println("Enter the name of the contact to be searched :");  

contactName=sc.next();

System.out.println(GetPhoneNumber(contactNameList,phoneNumberList,contactName,records));  

}  

}

Explanation:

In the following the function defined above for getting the contact

number on the basis of contact number provided we are checking the contact name list if we are able to find the contact name and if we did we return the contact number on the same index from the contact number list

which we found in the contact name list.

You might be interested in
Which of the following is not a data type available in VB.NET?
deff fn [24]
The obvious answer to your question: Which of the following is not a data type available in vb.net is OPERATOR. Integers, strings, and date time are all data types. They are commonly used to store data accordingly to what type they are.
6 0
3 years ago
How old was the mummy where they found a wooden prosthetic toe on him?
White raven [17]

Answer:

950 Bc and 710 bc

Explanation:

They could of course have remained bare foot or perhaps have worn some sort of sock or boot over the false toe, but our research suggests that wearing these false toes made walking in a sandal more comfortable," she continued. The wood and leather toe was made for a woman that likely lived between 950 BC and 710 BC.Oct 2,

6 0
3 years ago
How can an administrator initiate a system state recovery using the command line?
LUCKY_DIMON [66]

A leader creates a system state recovery utilizing the power cord wbadmin start system state recovery.

<h3>What is the power to start a system state restoration?</h3>
  • Windows has a built-in tool that lets you back up and repairs a server's system state, which is quick and easy to use.
  • The Wbadmin can be operated with the Start System State Backup order to create a blockage of the system state for a computer and the Start System State Recovery order to restore the system state.
  • Use the order -backuptarget:\\servername\sharedfolder\ to store system state backups.
  • Runs the power without prompts to the user.
  • The System State information reference in Backup Manager lets you support the design of your working system and vital system features such as the Registry, boot files, SYSVOL directory, and Active Directory.

To learn more about, start system state recovery, refer to:

brainly.com/question/24180931

#SPJ4

4 0
2 years ago
Which term is used to describe a network security device or host software that filters communications, usually network traffic,
tensa zangetsu [6.8K]

This term could apply to a router.

4 0
3 years ago
When you add an rss feed to hootsuite publisher, posts from blogs and websites you designate will be?
Cloud [144]

All answers are correct.

Source and explanation: certificationanswers.com/en/category/hootsuite-platform/

8 0
3 years ago
Other questions:
  • You have been hired to set up a network for XYZ Enterprises. What factors will you consider to determine the type of network nee
    7·2 answers
  • I have a samsung tab 2 10.1 and all of my apps stopped working. Can anybody help me?
    13·2 answers
  • It is always better to run over and give more information when you are giving a presentation versus quitting on time. true false
    15·2 answers
  • Suppose h(m) is a collision-resistant hash function that maps a message of arbitrary bit length into an n-bit hash value. is it
    5·1 answer
  • 4.2 Code Practice: Question 1
    14·1 answer
  • After a business transaction has been analyzed, which of the following must occur for the analysis to have been done correctly?
    9·1 answer
  • If you need to change the typeface of a document, which menu will you choose?
    6·1 answer
  • IF YOU WANT NICELY ENGLISH MUSIC ADD MY W.h.a.t.s.A.p.p nomber <br>+60 199094836​
    5·1 answer
  • To reposition the legend to the left-hand side of a chart, click the _________ button, point to legend, click the right arrow ic
    7·1 answer
  • Select the correct answer.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!