Yorkville High School Computer Science Department
Yorkville High School Computer Science Department on Facebook  Yorkville High School Computer Science Department Twitter Feed  Yorkville High School Computer Science Department on Instagram

Yorkville High School Computer Science

ASSIGNMENTS: No Current Assignments

Computer Programming I :: Projects :: Leap Years

Problem

Leap years are necessary because the earth revolves around the sun once every 365.242199 days. Without adding a day to the calendar every four years we would end up losing nearly six hours a year, which can add up to losing a day after just four years. A leap year must satisfy these conditions:

  1. The year must be divisible by 4
  2. The year must NOT be divisible by 100 unless...
  3. The year is divisible by 400

For this project the user will enter two years. The program will determine how many leap years are in between the two given years. You should also write out the steps of your algorithm before beginning your program.

Specific Requirements

  1. Write the steps of your algorithm and turn them in along with your finished program.
  2. Use text boxes for the start and end years.
  3. Integer variables should be used to store the text box contents.
  4. A while loop should be used to run through the range of years.
  5. Modulus should be used to determine the divisiblity of the years.
  6. A MessageBox should display the number of leap years between the two given years when the user hits a button.
  7. Determine a good name for each variable following the rules.
  8. Rename the form and all controls on the form using a three-letter prefix.
  9. Add a comment header following class guidelines.

Project Extension

Get the program to work using only one if statement.

Tips

Yorkville High School Computer Science Department on Facebook Yorkville High School Computer Science Department Twitter Feed Yorkville High School Computer Science Department on Instagram