Your program should prompt for the Month, (spelled out, string), day (integer) and year (integer) on which you were born, as well as a current date.
For example, ( user responses are given thusly)
Enter the month you were born: July Enter the day you were born: 22 Enter the year you were born: 1984 Enter the current month: July Enter the current day: 22 Enter the current year: 2004
You should validate each date to make sure that the data is accurate, but you do not need to check to see if the current date is later than the birth date. In other words, your users may type in the word May incorrectly, but they will not ask for a reading on a day before they were born.
You should compute the number of days the person has lived. Be sure to include leap days.
The theory of Biorhythms holds that we operate on three cycles, a physical cycle which is 23 days long, a emotional cycle which is 28 days long, and an intellectual cycle which is 33 days long.
The days in the first half of the cycle are "up" or positive days and the second half of a cycle are "down" or bad days. The cycle follows a sine curve and in the following picture, we see that on the 15th day of life, a person is UP, but on the way down intellectually, down and continuing down emotionally, and almost at the bottom physically.
Notice that each of the cycles repeats, so after 28 days, you will start over again on your physical cycle.
After computing how many days a person has been alive, you should compute how far into each cycle they are, and determine if they are up and going up, up and going down, down and going down or down and going up.
Example output may be
When were you born? Enter the Month: July Enter the Day: 1 Enter the Year: 2004 You were born July 1, 2004 What is today? Enter the Month: July Enter the Day: 16 Enter the Year: 2004 Today is July 16 2004 You have been alive 16 days. You are 15 days into your physical cycle and it is down and going down You are 15 days into your emotional cycle is down and it is going down You are 15 days into your intellectual cycle is up and it is going downThis is only example output, please feel free to format the output in any reasonable manner, but it must at least contain this information.
Notice, that after 23 days, you will start over on the physical cycle, so when you are 24 days old, you will b 1 day into your physical cycle and 24 days into the other two cycles.
You may need the following information. Normally the sine function is periodic (or repeats) with a period of 2pi. So sin(x) for x between 0 and 2pi looks like this
However, if you wish for the function to have a period that is longer, you can divide by the length of the period you want. So, for example, if I want a period of 20, I can plot sin(2*pi*x/20)
And I can tell that the function is up at period 3 since sin(2*pi*3/20) is .8 and since sin(2*pi*4/20) is .95, the next period will be even better.
There is quite a bit of work in this program. You should start by doing a functional decompisition. Next work on one part at a time. Perhaps only ask how many days a person has been alive, and compute where in each cycle they are. Continue to work incrmentally, documenting the code as you go.
You will need to have mastered if then else statements to be able to validate the dates, and compute the number of days the person has been alive.
Please email the completed program to dbennett@edinboro.edu.