Question
please help Create a program that prompts the user for a sentence and then displays the hash of the sentence. Refer to the textbook Chapter
please help
Create a program that prompts the user for a sentence and then displays the hash of the sentence. Refer to the textbook Chapter 5.2 and the Support Video in zyBook section 3.1 for more instruction on hashing.
Program Requirements:
The program should prompt the user for the "sentence" to be hashed and then compute the hash of the sentence by summing the numeric value of each letter in the sentence (use A=a=1, B=b=2 ... Z=z=26, space=31) and applying the hash function f(n) = sum mod 31. Repeat the prompt and computation until the user enters a sentinel value to quit.
For example:
If the user enters: | the hash is: |
hello | 21 |
pooh bear | 18 |
We the People of the United States in Order to form a more perfect Union | 27 |
- The sentence may be as small as a single word or contain multiple words
- The sentence can contain upper case and lower case letter but no numbers or symbols.
- Provide some test cases
I should key in along with the expected outcome of the provided values. Review the Developing Test Cases document in the Getting Started module for some examples of how to create/format test cases. - Don't use my examples as your test cases...
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started