Question: 1 char digits [] = id.toCharArray(); Then you can loop through the digits array adding up each element. That produces a sum of the ASCII

1 char digits [] = id.toCharArray();\ Then you can loop through the digits array adding up each element. That produces a sum of the ASCII value of all the letters. Remember to skip (i.e., don't add) any character that is "' (hyphen).\ This sum you can then use with a mod operation with the second argument size to get the hash key.\ Return this hash key.\ Examples:\ hashKey ("834-1234", 10)

->1

\ hashKey("8341234",10)

->1

\ Your Answer:

 1 char digits [] = id.toCharArray();\ Then you can loop through

Then you can loop through the digits array adding up each element. That produces a sum of the ASCII value of all the letters. Remember to skip (i.e., don't add) any character that is '-' (hyphen). This sum you can then use with a mod operation with the second argument size to get the hash key. Return this hash key. Examples: hashKey("834-1234",10)1hashKey("8341234",10)1 Your Answer: Then you can loop through the digits array adding up each element. That produces a sum of the ASCII value of all the letters. Remember to skip (i.e., don't add) any character that is '-' (hyphen). This sum you can then use with a mod operation with the second argument size to get the hash key. Return this hash key. Examples: hashKey("834-1234",10)1hashKey("8341234",10)1 Your

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!