logo CodeStepByStep logo


Language/Type: VB function basics return

Write a function DateIsBefore that takes as parameters two month/day combinations and that returns whether or not the first date comes before the second date (True if the first month/day comes before the second month/day, False if it does not). The function will take four integers as parameters that represent the two month/day combinations.

The first integer in each pair represents the month and will be a value between 1 and 12 (1 for January, 2 for February, etc, up to 12 for December). The second integer in each pair represents the day of the month (a value between 1 and 31). One date is considered to come before another if it comes earlier in the year.

Below are sample calls on the function.

Method Call Return Explanation
DateIsBefore(6, 3, 9, 20) True June 3 comes before Sep 20
DateIsBefore(10, 1, 2, 25) False Oct 1 does not come before Feb 25
DateIsBefore(8, 15, 8, 15) False Aug 15 does not come before Aug 15
DateIsBefore(8, 15, 8, 16) True Aug 15 comes before Aug 16
Function: Write a VB function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.