*in java*
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. 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 getPhoneNumber(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.
import java.util.Scanner;
public class LabProgram {
/* Define your method here */
public static void main(String[] args) {
/* Type your code here. */
}
}
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
- Your Friendly Array Neighbor Program only in java not in python Create a Java program that takes an array called ar as an input that keeps track of arrays. Every day a new array is produced using the array of the previous day. On the n’th day, the following operations are performed on the array of day n – 1 to produce the array of day n: -If an element is smaller than both left and right neighbor, then this element is incremented -If an element is bigger than both its left neighbor and its right neighbor, then this element is decremented. -The first and last elements should never change Eventually after some days the array will not change, some examples: Example: Input from user: ar = [6,2,3,4] Output from program: [6,3,3,4] After the first day the array is changed from [6,2,3,4] to [6,3,3,4] and no further operations may be completed. Example: Input from user: ar = [1,6,3,4,3,5] Output from program: [1,4,4,4,4,5] After the first day the array is changed from [1,6,3,4,3,5]…arrow_forwardPythonarrow_forwardCreate in Java (1) Create an array of String objects and populate it with the days of the week (7 days)(i.e., Monday - Sunday)(2) Create an array parallel to the one created in (1) to store the entrées. However, you do not have this information, soyou will need to write a loop that prompts the user to enter the entrée served on that day. This prompt shouldinclude the day for which you are asking for the information (e.g., "What entrée is being served on Monday?")(3) Create another parallel array that stores the prices. You will also need to collect this information from the user. Thistime, your prompt should include the name of the entrée for which you are asking for the price(4) Prompt the user to choose an entrée from a list that you display numbered 1 through 7 (have them input a number1 to 7) and search the array and output the day on which the entrée will be served(5) Search through the array for the highest price entrée and output the name of this entrée for the user including…arrow_forward
- C Programming Language Note: Input and Output Must be the same Write in C Languagearrow_forwardC++arrow_forwardmergeAndRemove(int[], int[]) This is a public static function that takes a int[] and int[] for the parameters and returns an int[]. Given two arrays of integers. Your job is to combine them into a single array and remove any duplicates, finally return the merged array.arrow_forward
- Given an integer array of positive single digit values such as:int a[] = {8,4,2,6,9};1) Write a recursive arrayToN function which returns the concatenation of all array values as an integer value.This function should accept all required data as parameters and return a long integer value.ExamplesIf the array is 8 4 2 6 9 the arrayToN function returns the integer 84269.If the array is 0 2 6 8 9 3 5 1 the arrayToN function returns the integer 2689351.arrow_forwardJava Programarrow_forwardIn C write a grading program as follows.- Ask the user for the number of students and store it in an integer variable.- Create an array of floats with four rows and columns equal to the number of students storedearlier.- Initialize the array to zeros.Create a menu with the following options (use a do-while loop and repeatedly display the menu):A or a to add student info one student at a timeT or t to display class average for homeworkS or s to display class average for quizzesB or b to display class average for examsZ or z to exit program (program repeats until this exit command is entered)arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education