Happiness estimator

Make a worksheet like this:

Worksheet

Everyone's happiness index starts off at 50. Subtract their age. Older people realize how futile life is.

If they have a degree in accounting, their happiness index goes down by 20. If they have a degree in econ, their happiness goes down by 10. If they have a degree in MIS, their happiness index goes up by 20.

The effect of humor depends on their degree. If they have a degree is accounting, subtract the humor rating from the happiness index. A sense of humor makes accountants sadder. If they have a degree in another field, add the humor rating.

Output the result. Here's an example:

Output

Validate the degree. Make sure the user enters Acc, Econ, or MIS. Case doesn't matter (mis and ACC are OK). You can assume that all other input data is correct.

EXTRA: Validate the rest of the input.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

Referenced in: