
-----------------------------------
saifhero
Wed Dec 12, 2012 9:03 pm

code i need help with
-----------------------------------
Write a Turing program which asks the user to enter the current date (use 3 separate variables, 
i.e. one for day, one for month, one for year), asks the user for their birth date, and then 
calculates and reports how old they are (in years only).  Remember to account for the situation 
where they have not yet had their birthday this year.  Include a proper header and full 
documentation. how would i do this i really need help!!

-----------------------------------
Insectoid
Wed Dec 12, 2012 9:11 pm

RE:code i need help with
-----------------------------------
What have you tried so far?

-----------------------------------
saifhero
Wed Dec 12, 2012 9:23 pm

RE:code i need help with
-----------------------------------
Im totally new to this all, so i really dont have much

-----------------------------------
Insectoid
Wed Dec 12, 2012 10:33 pm

RE:code i need help with
-----------------------------------
What's the first thing the program does? Maybe you should start with that.

-----------------------------------
saifhero
Wed Dec 12, 2012 10:42 pm

RE:code i need help with
-----------------------------------
%AGE PROGRAM

%DECLARATIONS
var day, month, year : int
var bday, bmonth, byear : int
var age : int 

%GET ALL INFORMATION FROM THE USER
put "Enter the Current date (Day) " ..
get day
put "Enter the Current date (Month) " ..
get month
put "Enter the Current date (Year) " ..
get year
put ""
put "Now enter your Birthday "
put ""
put "Birthday (Day) " ..
get bday
put "Birthday (Month) " ..
get bmonth
put "Birthday (Year) " ..
get byear

%CALCULATE AGE


%AGE IS EQUAL TO 2012 SUBTRACT THE YEAR THE USER INPUTS
age := year - byear



put ""
put day, "/", month, "/", year
put ""
put bday, "/", bmonth, "/", byear

put "You are ", age, " years old"


i have this but it always gives the age of zero

-----------------------------------
Panphobia
Wed Dec 12, 2012 11:16 pm

RE:code i need help with
-----------------------------------
working fine for me :S

-----------------------------------
jr5000pwp
Thu Dec 13, 2012 12:16 am

RE:code i need help with
-----------------------------------
That should work, but you will need to figure out if they have had their birthday this year.

How would you go about that? Imagine if I put in my birthday as December 25th. How would you go about seeing if that birthday has passed?

An easy way to do this is to figure it out on paper, how can you explain to someone who is completely incompetent how to solve this problem?
