Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 2.66 KB

File metadata and controls

38 lines (24 loc) · 2.66 KB

Lab 3.3 - Let me check my calendar

In this lab, you will write custom blocks that take parameters and are useful for calculations involving dates and calendars.

Part 1: Basics

  1. Write a custom block called month name that takes a number between 1 and 12 as an parameter and says the name of the corresponding month.

  2. Write a custom block called day name that takes a number between 1 and 7 as an parameter and says the name of the corresponding day. For our purposes, the week begins on Sunday.

  3. Write a custom block called days in that takes a month name as an parameter and says how many days are in that month. Assume a non-leap year.

Part 2: Going Farther

  1. Write a custom block called is a leap year that takes a year number as an parameter and says whether or not that year is a leap year.

    • A year is a leap year if the year is a multiple of 4 that is not a multiple of 100 (e.g. 1984), or if it is a multiple of 400 (e.g. 2000). Years that are multiples of 100 but not multiples of 400 are NOT leap years (e.g. 1800). See Wikipedia for more detail.
  2. Write a custom block called is a valid date that takes a month name and a date as parameters and says whether or not that date exists in that month. For example, the 31st is a valid date in January, but not in June. The 5th is a valid date in every month, and the 40th is not a valid date in any month.

  3. Write a custom block called day in year that takes a year number and a number between 1 and 366 and says the date that corresponds to that numbered day of the specified year. For example, in non-leap years day #1 is January 1, day #32 is February 1, day #365 is December 31, and day #185 is July 4. Give an error message if the number is 366 and a non-leap year is specified.

    Bonus: Determine the day you were born. Write a custom block called day of week that takes a month name, date, and year as parameters and says the day of week on which that date falls in that year. See Wikipedia for information on finding the day of the week from a date.

  4. Save your project as Lab3.3.

Grading rubric

Criteria Points
1.1 month name 0.5
1.2 day name 0.5
1.3 days in 0.5
2.1 is leap year 0.5
2.2 is a valid date 0.5
2.3 day in year 0.5
Bonus: day in week 0.5
Total 3.0