Repetition 2: A month's calendar: Spring 2024

26 Jan 2024 - 16:32 | Version 1 |

Learning Objective(s)

  1. Improving repetition skills
  2. Learn the for loop
  3. Become independent when using selection statements
  4. Learn to use a switch statement

Overview of the Program

For this lab you are to create a program that displays the calendar of a month.

Specifics

  • The program should be called DisplayMonth
  • Input should be the year, followed by the month, and then the day it starts on (with Sunday being 0 and Saturday being 6)
  • The name of the month should be displayed first (you may choose the language)
  • You must use at least one for statement
  • You must account for leap year. Note: leap year is not a simple as every four leaps. Research the details.
  • The month days should line up nicely.

Sample dialogue

Below is a sample dialogue. Your output can vary somewhat as long as the required data is nicely displayed
What is the year, month and day of the week?
2023 09 05
September
                1  2 
 3  4  5  6  7  8  9 
10 11 12 13 14 15 16 
17 18 19 20 21 22 23 
24 25 26 27 28 29 30 
You can also run a solution for this program if you want. See classroom instructions for more details.

Submission

  1. Create your SDR.
    • In Lessons Learned, include a discussion on which selection statements you used and why. Also include a discussion on how complex the code seems
    • Your testing should include at least 2 different types of errors and ensure that every line of code is executed at least once and there is a least one month for each starting day. The actual start day does not have to be accurate (unless you are doing the extra credit)
    • If you used any hints, be sure to indicate that in the Outside Resources Used section
  2. Convert your SDR into a pdf document
  3. Create an empty zip folder
  4. Place your java file and pdf document in it.
  5. Submit the zip folder on canvas

Hints

  1. Algorithm hint
  2. Leap day
  3. Formatting nicely

Optional improvements

Optional improvements should ONLY be worked on once the program is completing working. In addition, the work is to be done on your own with little if any help for lab assistants or the instructor.
  1. Compute the first day of the month
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback
This website is using cookies. More info. That's Fine