Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function name randValues0to9 that takes a string from the user as an argument and generates a random integer between 0 to 9. To

Write a function name randValues0to9 that takes a string from the user as an argument and generates a random integer between 0 to 9. To generate a random value you need a seed. As your range is 0 to 9, by doing seed%(9+1), you will get a random value between 0 to 9. To generate the seed, you need to count the number of vowels and consonants in that argument. If the vowels are less in number than the consonants, then your seed will be, seed = no_of_vowels*no_of_consonants+21. Otherwise, your seed will be, seed = no_of_vowels*no_of_consonants+57 ================================================ Function Call1: randValues0to9("H@#ello Pe3ter!!") Sample Output1: Vowels: 4 Consonants: 6 Seed: 45 Random value: 5 Explanation1: In H@#ello Pe3ter!!: string, there are 4 vowels and 6 consonants. So the vowels are less in number than the constants and the seed is, seed = no_of_vowels*no_of_conostants+21 => seed = 4*6+21 = 45 As your seed is 45, your random value is 45%10 = 5. ================================================ Function Call2: randValues0to9("Ayeeeeeeeeeeeee lmao")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

Briefly explain the concept of fund accounting.

Answered: 1 week ago

Question

Has the priority order been provided by someone else?

Answered: 1 week ago

Question

using signal flow graph

Answered: 1 week ago