Lab 2: Conditionals in Millennial Marketing Survey

For this lab we will be designing a validator that checks the age of the person for a millennial marketing survey.

The user will be asked to enter an integer for month, day, and year, and then the program will validate the date, ensuring that the day value is <= 31, the month value is between 1 and 12 (inclusive), and the year is >=2000.

Sample runs, checking each of the three input values, with 1 point the year and the month. The check for day is extra credit.

Lab Activity:

1) Validate the year

        Sample runs, checking each of the year in the three input values and say “Sorry, you are too old.” , if the user is born before the year 2000.

For example:

Welcome to the millennial marketing survey. First we have to make sure you are not too old for this.

Please enter the month, day, and year you were born: 9 20 1999

Sorry, you are too old.

2) Validate the Month

        This part will check the year (done in the last step) and the month.

For example:

Welcome to the millennial marketing survey. First we have to make sure you are not too old for this.

Please enter the  month, day, and year you were born: 13 20 2000

Sorry, the month value is invalid.

3) Extra Credit - Validate the day for months in 2018   

Have your program handle actual day values also this time but only for the months in 2018 (so you don’t have to take leap year into account), such as the fact that different months have different numbers of days.

For example:

Welcome to the millennial marketing survey. First we have to make sure you are not too old for this.

Please enter the  month, day, and year you were born: 8 32 2000

Sorry, the day value is invalid.

So at this point if all three checks go through you should have a message,"Wonderful, you are just the right person.".

So the extra credit should first check the year, then display the message if the year is not valid. If the year is valid the program should then check for the month and so on.

For example:

Welcome to the millennial marketing survey. First we have to make sure you are not too old for this.

Please enter the  month, day, and year you were born: 5 6 2000

Wonderful, you are just the right person.