Assignment Instructions

Edit, compile, and run the following program on the UH UNIX shell:

Make sure you use these in your program: symbolic constants, double, int, type casting,
conversion (format) specifiers, and puts() function.

Ask the user to enter the day, month, and year they were born.

Use function
getdouble()
to get the dates from the user.

The function
getdouble()
requires the use of files
getdouble.c and
getdouble.h and
alterations to the makefile
makefiledouble.

DON'T FORGET TO ADD THIS HEADER FILE to the top of your program,
or function getdouble() will not return the correct value:
#include "getdouble.h"

Display the current date. You can use the assignment due date as the current date.

Calculate the user's age in days.

The easiest way to do this is to calculate the number of days since year 1 for today's date and the birthdate,
then subtract the number of days since year 1 for the birthdate from the number of days since year 1 for today's date.

Calculate the number of days since year 1 for the current date by:
(1) multiplying the year by 365.25 to account for leap years every four years,
(2) subtract one from the month (so September would be 9  1 = 8) and multiply this by 365.25/12.0, and
(3) adding both results to the day of the month.

Example formula: days = (year * 365.25) + ((month  1) * 365.25 / 12.0) + day

Calculate the number of days since year 1 for the birthdate by:
(1) multiplying the year by 365.25 to account for leap years every four years,
(2) subtract one from the month and multiply this by 365.25/12.0, and
(3) adding both results to the day of the month.

You can check your calculations by using this website: Age Calculator.

Don't worry if your calculations are off by a few days.

OPTIONAL:
When you display the user's age in days, put a comma in the 1000s place by separating the number into two parts using division and modulus by 1000.
In other words, the 1000s place is calculated by totalDays/1000.
The first three digits are calculated by totalDays%1000.
To include extra zeros on integers, use .3 precision as shown in format.c.

Otherwise, just print out the number of days without the comma.

Email your makefile and C program to the instructor.
Example I/O
Here is example input and output from three different birthdays.
This is from running the same program three times.
In other words, you just have to ask the user one time for their month, day, and year.
You do not need to ask three times.
You can use the output below to test your code three times.
This program will calculate your age in days.
Enter the month you were born: 7
Enter the day you were born: 1
Enter the year you were born: 2005
Today's date is: 9/1/2016
Your age in days is: 4,078
This program will calculate your age in days.
Enter the month you were born: 7
Enter the day you were born: 30
Enter the year you were born: 1975
Today's date is: 9/1/2016
Your age in days is: 15,007
This program will calculate your age in days.
Enter the month you were born: 10
Enter the day you were born: 3
Enter the year you were born: 1950
Today's date is: 9/1/2016
Your age in days is: 24,074