Algorithm hint for displayMonth method

  • get the number of days in a month (from another method) (numDays)
  • display the title of the month (using another method)
  • display the spaces for the missing days of the month (using another method)
  • first day of the current week (first week) is 1 (firstDay)
  • last day of the current week (first week) is 7 - starting day (lastDay)
  • while the last day of the week is < the last day of the month (lastDay, numDays)
    • display that week (using another method)
    • add seven days to both of the variables (firstDay, lastDay)
  • display the remaining partial week (first day of current week to number of days in the month) (firstDay, numDays)


This topic: CenterForComputing > WebHome > Syllabi > CSC121SylS2024 > CSC121S2024Lab05 > CSC121S2024Lab05Hint1
Topic revision: r1 - 2024-02-06 - CathyBareiss
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback