Specifications: Your program is to prompt the user for input of their age (an integer), the approximate weight of their brain1 in pounds (an integer), and whether or not they regularly eat glue. (Some clients need extra help. See picture at right.) For this last input, your prompt should request a 0 (for no) and 1 (for yes), and the value be assigned to a boolean variable. These inputs are to be used in this formula:
letter = [ (brain wt / age) * K ] mod 26 + 65 + 32(but only if they eat glue),
where 26 is a formula constant (that happens to be Homer's IQ)
65 is another formula constant (representing daily doughnut consumption for Homer)
32 is yet another formula constant (that is the average IQ of people who
Background: This semester, you will be working as a software developer for a client who is an established, well-connected and talented intellectual giant. In the programming assignments over the course of the next few months, Homer Simpson (pictured at right) will require your programming acumen and expertise, outlining what programs will make his life easier - something he dearly needs. Yes....he is your boss. Disturbing, isn't it? Imagine him in politics! Homer now needs your help to write a program to generate passwords for a new online "Brainwave Generation Exercise" business he wants to start. Each client would enter personal information that is to be used by the program to produce a password. The password must be 'strong' so he has devised the most bestest solidest-ish formulation that will output characters (letters) for the password. The formula is used 4 times for a 4-letter password.
Due: Friday, Sept. 4, 2020 at noon 100 pts
For this assignment, you will submit a single C++ compilable file containing a program written in C++.
Note also: You are not allowed to use conditional statements (if or if-else) in the program. Think carefully how to use the information you have input from the user, how it is stored, how boolean variables are represented.
Note also also: It is up to you how you want to name your variables and constants. Don't think that you should copy names that your employer/teacher/mentor(see picture above) use to describe a problem. YOU are writing the code.
Special Note: By the time you read this, you will have had the hierarchy of types, automatic conversions, and casting explained to you. And when you assign the value of a 'higher' type variable (say, a float) to a 'lower' type variable (say a short), information is lost - the decimal part is discarded. Using the compiler call fg++ allows that behavior without any compiler error or warning. However, to insure that the reader of the code (and the compiler) understands that this is indeed what you want to do, you should explicitly cast the value.
Your program should be "user friendly" in that it should have an opening statement or greeting, user friendly and understandable prompts, and clear and concise outputs and sign-off. Here's a good example of bad output:
enter stuff: 52 6 0
5
Notice that there are NO prompts to speak of, and the output is completely unexplained. This is horrible output. Something like the following is much much better:
Welcome to the PASSWORD GENERATOR
Please enter the following information:
what is your age: 77
how much does your brain weigh: 6
do you eat glue regularly: 1
Your password is: cjrz
Have a nice day and don't forget that password!
To submit, you will use git as you have been shown in the lab and by the cs 1570 grader. And remember, this is a cs 1570 assignment, not a lab assignment.
As always, if you have any questions about this assignment, be sure to ask your (lecture) instructor.
1There are options for obtaining this value
remove your brain and take it to the post office for an accurate weighing
make a bowl of oatmeal and weigh it
just lie - your mother will forgive you...this time.
Note: The computation on the right hand side of this formula will produce a number. However, it is implied that the left hand side of the formula is a character (a letter). Assigning a number to a letter would seem an odd thing to do. But this allowed by C++. However, it is important that you write your code in such a way as to make it clear it is your intention to do so. Think about converting from one type to another. The number so generated on the right is to be the ASCII value of the character on the left.
Now, for the sake of security, after each use of the formula, the value of K must change after each use. Thus, subsequent letter generations by this formula must use the previous value of K incremented by 100.
eat glue regularly) K = the product of the three preceding constants