HomeChallengesRepsProblemsLeaderboardTake a challenge

Where this hides

Every function takes a CalendarData as its first parameter. Move the functions into the class whose data they read, and watch that parameter disappear — without ever really going away.

Beginner10 min on the clock5 graded checks · 100 pointsFrom Procedures to Objects
Graded by reading your code against the checklist below.

What you build

  • Replace CalendarData and Admissions with one SchoolCalendar class
  • Make GetSchoolDate and GetSchoolBirthday instance methods with no data parameter
  • Keep IsValidDate static
  • Make the fields private and set them in a constructor
  • Update the calls in Main to lagos.GetSchoolDate(...)

Done means

The methods that read the data live on the object, take no data parameter, and the static method stays static.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. The data-reading methods are instance methods+25Data that belongs to one object
  2. No method takes the data as a parameter+25Data that belongs to one object
  3. IsValidDate stays static+20Data that belongs to one object
  4. Calls put the object before the dot+15Data that belongs to one object
  5. The fields are private+15Objects that protect themselves

What it teaches

Data that belongs to one objectbeginner

A static field exists once for everyone, so two callers overwrite each other; an object is a private copy of the data, and its methods reach that copy through the this the compiler passes for you.

The rest of From Procedures to Objects