Due: Wednesday, Oct. 7, 2020 at noon 100 pts
For this assignment, you will submit a single C++ compilable file containing a program written in C++.
Name your file a meaningful name and give it a .cpp extension since you will be compiling it. Also, make sure that you compile and run your program using the GNU (g++) compiler before submitting to make sure that it will work for the grader.
Background: All you need to know is here. Well, not quite. Homer, your mental giant of a boss, is dissatisfied with the size of the passwords your code for hw 1 generates; they are not very secure. He is also unhappy with the repeated code that was used for that program! Usually, everything has to be repeated for Homer, but repetition of code is anathema to this man since he doesn't even understand the first instance of it. The word 'anathema' is anathema to Homer also since he has no clue what it means. Please don't use the word 'anathema' around Homer.
Sooooo, your code will generate (at this time) passwords that have 9 characters rather than only 4 letters. Also, security is compromised by the fact that the character set is limited to alphabetics. Homer wants your program to randomly inject digits into the passwords. Thus, for every time your code generates a new character, there is a 50-50 shot that it is a randomly chosen digit between and including 0 and 9.
Specifications: You are to modify the solution posted for HW #1 (NOT your own solution for HW #1!) to use functions according to the specifications listed below.
Make a function to output the welcome message. There should be no parameters or return value for this function.
Make a function that will prompt for and get input for a short integer, validating the input. The parameters to this function should be a string prompt (which will be output to the screen), a short minimum value, and a short maximum value. The latter two parameters constitute the valid range of input values (inclusive) the user is allowed to enter. This function should return the (validated) short integer that the user entered.
Make a function to calculate a single character of the password. The parameters to this function should be the user’s age, brain weight, whether or not s/he is a glue eater, and the current value of the kFactor. The return value of this function should be the calculated character.
Make a function to output the sign-off message. There should be no parameters or return value for this function.
You are to use the above functions in your program. If you want to make other functions, you may do so. But your program should appropriately utilize these functions to perform the task described in HW #1. The function you write for (2) above should be used to get (each of) the inputs for age, brain weight, and whether or not the user regularly eats glue. The minimum and maximum values for age are 1 and 100, respectively. The minimum and maximum values for brain weight are 0 and 10, respectively. And, you will of course loop on the execution of function #3 above. Also, increment the kFactor only if you generate a character, not if you put in a digit.
By the time you submit this program, we will have covered multiple files in the lecture. However, you are to do this program in a single file only. As you were shown, put global constants and prototypes above main, and put function definitions below main. Also, you will be required to give full documentation of your functions (description, pre-, and post-conditions). That material will be covered very soon in your lecture.
Just before you commit your final draft of this program, comment out the line of code in your program that seeds the random number generator and replace it with srand(5);. This will (almost certainly) ensure the output of everyone's code is the same and make our graders less likely to go insane.
As usual, if you have any questions, be sure to ask your instructor.