Question

In: Computer Science

6. Store your important phone numbers in a hash. Write a program to look up umbers...

6. Store your important phone numbers in a hash. Write a program to look up umbers by the person’s name in perl language.

Solutions

Expert Solution

To write code for important phone number in Hash and look up numbers by the person's name in perl language;

Before implementing this code we have to write some explaination of this code;

Initialization of hash & fetching an element to the hash: -

A hash variable can be initialized with key/value pair during it's declaration time . There are two ways for initialize the hash variable one is using => which is called the fat arrow or fat comma .

And the second one is to put the key/value pair in double quote(" ") & separated by comma(,) .

To access the individual element from hash use the symbol ($).

These are the things we are going to used in our code:

#perl program to demonstrate the

#Fetching an element of a hash with Mobile number.

#creating hash

%rateof = (" Amol "=> 9834562730 , " john " => 9934562738, " krish " => 9735261781 );

#fetching an element of hash

print  "$rateof { 'Amol'}\n" ;

print "$rateof {'john'}\n;

print "$rateof {'krish'}\n" ;

output:

9834562730

9934562738

9735261781


Related Solutions

You will write a program that prompts the user to enter a 7-digit phone numbers, and...
You will write a program that prompts the user to enter a 7-digit phone numbers, and finds the 3- and 4-letter words that map to the phone number, according to the restrictions outlined earlier. A sample run: unixlab% java MapNumbers Enter name of dictionary file: words10683 Enter a test word (3 letters): cat Test word maps to 228 Enter telephone number (7 digits, no 0's or 1's, negative to quit): 2282273 Options for first 3 digits: act cat bat Options...
Write a program in Python to print all possible combinations of phone numbers. The length of...
Write a program in Python to print all possible combinations of phone numbers. The length of the number will be given. Also 3 digits will be given, which can not be used. No two consecutive digits can be same. A number containing 4 would always have 4 in the beginning.
Write a program in java which store 10 numbers and find the sum of odd and...
Write a program in java which store 10 numbers and find the sum of odd and even numbers. Create a program that uses a two dimensional array that can store integer values inside. (Just create an array with your own defined rows and columns). Make a method called Square, which gets each of the value inside the array and squares it. Make another method called ShowNumbers which shows the squared numbers. Write a program in java which has an array...
Write a program in java which store 10 numbers and find the sum of odd and...
Write a program in java which store 10 numbers and find the sum of odd and even numbers. Create a program that uses a two dimensional array that can store integer values inside. (Just create an array with your own defined rows and columns). Make a method called Square, which gets each of the value inside the array and squares it. Make another method called ShowNumbers which shows the squared numbers.
Write an application, Phone Numbers, that creates and prints a random phone number of the form...
Write an application, Phone Numbers, that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the output. The phone number has some constraints. Do not let the first three digits contain an 3 or 7 (but do not be more restrictive than that) and ensure that the second set of three digits is not greater than 825. Note that any of the digits can be zero and zeroes should be shown.
Write a program that takes a set of m numbers up to size n and save...
Write a program that takes a set of m numbers up to size n and save them in an array. The program then allows you to search for any number in the array with O(1).
Overview: You will write a program that reads up to 100 numbers from a file. As...
Overview: You will write a program that reads up to 100 numbers from a file. As you read the numbers, insert them into an array in ascending order. Specifics: 1A. Write a function called insertIntoSortedArray . i. It should take three arguments - a. myArray[ ] : sorted array that should be able to hold at most 100 integers. b. numEntries : the number of elements inserted so far. c. newValue : the incoming value to be inserted into the...
WRITING: Write a couples sentence cell phone use policy for your store. This policy will be...
WRITING: Write a couples sentence cell phone use policy for your store. This policy will be displayed throughout the store (in a banner,sign). Add a one page cover note explaining where and how the notice will be distributed. This cover note is only for the employees of your cafe. Backstory: You own a small new-and-used book store and café with free wireless Internet access. You enjoy the calm, quiet atmosphere of your store and like that your customers choose your...
C++ Bubble Sort Write a program that ask user to enter 7 numbers and store that...
C++ Bubble Sort Write a program that ask user to enter 7 numbers and store that in array. Display that all numbers before and after performing Bubble sort. You must have to create new function with required parameter to perform Bubble sort. Sample Run :- Enter 1 number :- 1 Enter 2 number :- 5 Enter 3 number :- 7 Enter 4 number :- 45 Enter 5 number :- 90 Enter 6 number :- 6 Enter 7 number :- 55...
in C++, Write a program that asks the user to enter 6 numbers. Use an array...
in C++, Write a program that asks the user to enter 6 numbers. Use an array to store these numbers. Your program should then count the number of odd numbers, the number of even numbers, the negative, and positive numbers. At the end, your program should display all of these counts. Remember that 0 is neither negative or positive, so if a zero is entered it should not be counted as positive or negative. However, 0 is an even number....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT