5 Functions [10 marks]
Create a function that performs the following steps:
- Starts with the input variable value
addresswhich is the street address of the function user’s house - Doubles the value from Step 1.
- Adds
42to the result from Step 2. - Multiplies the result from Step 3 by
50 - Subtracts the value of the input variable
birthYearfrom the result from Step 4;birthYearis the year of birth of the function user - Subtracts
50from the result from Step 5 - Adds the value of the input variable
numBirthdaysto the result from Step 6;numBirthdaysis the number of birthdays that the function user has had this year (i.e., either0or1) - Subtracts
31from the result from Step 7 - Computes the value
lastwhich is equal to the last two digits from Step 8; for example, if the value in Step 8 is97218thenlastis18 - Computes the value
firstwhich is equal to removing the last two digits from Step 8; for example, if the value in Step 8 is97218thenfirstis972
Your function should satisfy the following constraints:
- it should be named
addressAndAge - it should return two values
firstandlast(see Steps 9 and 10 above for details) - it should have three input values
address,birthYear, andnumBirthdays(the street address, year of birth, and number of birthdays that the user has had this year)
Your function must execute the steps as described above to compute the values first and last.