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
23+ Composition refers to
Law Incorporation [45]

Answer:

c. The placement and relationship of  elements within a picture

Explanation:

Required

What composition means?

Literally, composition means the way the elements of a picture are presented. The elements in this case constitute all lines, shapes, dots, pattern and many more.

You will notice that some of these elements will be placed over one another, some side by side, some far from one another.

So, composition means the way these elements are displayed.

<em>Hence, option (c) is correct.</em>

3 0
3 years ago
Which of the following statements about moving averages is not true?
AleksAgata [21]

Answer:

The answer is "Option D"

Explanation:

The term moving average is known as a time series of information, which is widely used to reduce quick-term variations and demonstrate deep-term patterns or intervals. It is a type of matrices numerically, thus it could be considered as either an example of a tiny-pass filter for data processing, and correct options can be described as follows:

  • In option A,  It is used in a smooth series.
  • In option B, In this process, all the values are used in the calculation are equal in weight.
  • In option C, It is the simplest method, which is used in exponential smoothing.
7 0
3 years ago
In the code snippet, what is the “win” part called in programming?
MAXImum [283]
I think the answer is B: parameter
8 0
3 years ago
A computer program uses 3 bits to represent integers. When the program adds the decimal (base 10) numbers 5 and 3, the result is
Vinil7 [7]

Answer:

The correct option is 1 as the overflow error has occurred

Explanation:

As the program uses 3 bits to represent integers thus the range of the maximum value that the program can store is given as

2^2+2^1+2^0=4+2+1=7

So when the two numbers in decimal base 10 are added as 3 and 5 the resultant is given as

3=(011)_2\\5=(101)_2\\\_\_\_\_\_\_\_\_\_\_\_\_\\8=(1000)_2

This is more than what the 3 bit integer can store thus the overflow error has occurred.

3 0
4 years ago
How do these ideas connect?
Nesterboy [21]

Answer:they are connecting because they are showing adult good of either men or women

Explanation:

3 0
3 years ago
Other questions:
  • Explain the purpose of the frame check sequence (fcs) field in a data link frame trailer.
    7·1 answer
  • Array is special variable that can handle more than one value.
    6·1 answer
  • Darian has a gourmet cupcake business and needs a website to compete with the other bakeries in his area. He has a Google My Bus
    15·1 answer
  • PLS HELP GIVING 100 POINTS TO THE PERSON WHO WRITES IT
    6·1 answer
  • For this exercise, you are given a phrase. Return the number of time the word “dog” appears in the phrase.
    7·1 answer
  • Define a void function that calculates the sum (+), difference (-), product (*), quotient (/), and modulus (%) of two integer nu
    14·1 answer
  • SONET: is a standard for optical transmission that currently operates at Terabit per second speeds is almost identical to the IT
    7·1 answer
  • Consider the problem of making change for n cents using the fewest number of coins. Assume that each coins value is an integer.
    7·1 answer
  • What are some benefits that each computer system being used?
    12·2 answers
  • What is 11x12x12x14x15x16
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!