== Constants == Constant Integer MONTHS_PER_YEAR = 12 ==Inputs== Integer NumberOfDays // Number of days in the month Integer FirstDay // 1 for Sunday, 2 for Monday, etc String Ans // user's answer to continue for a day ==Process== loop to show spaces loop to show days show spaces up to the day the month starts track weekday using WeekDay // known as an accumulator ==Outputs== spaces days day numbers ==Other variables== String Ans Module Main Declare Integer NumberOfDays Declare Integer firstDay Display "I will display a calendar of a month." // loop to take user input until user wishes to continue // exit when user answers 'n' or 'N' for No do Display'Enter the number of days in the month:" Input NumberOfDays Display "Enter the first day of the month, 1 for Sunday," Display "2 for Monday, 3 for Tuesday, and so on." Input FirstDay Call DisplayMonth(NumberOfDays, FirstDay) Display "Do you want to see another month?" Display "(yes or no)" Input Ans until (Ans = "N") or (Ans = "n") Display "Have a good month" End Module // Main Module DisplayMonth(Integer NumberOfDays, Integer FirstDay) Declare Integer WeekDay Declare Integer DayCount Display "Mon Tue Wed Thu Fri Sat Sun " // Put blanks for each empty day at beginning For WeekDay = 1 To FirstDay - 1 do Display " " End For set WeekDay = FirstDay // go through each day in Month and print it. // Use the WeekDay to figure out where it is on the calendar column For DayCount := 1 to NumberOfDays do Display DayCount, " " // put the number in the 4 column field if (WeekDay mod 7) = 0 Then Display NL End If set WeekDay = WeekDay + 1 // Increase the accumulator End For Display NL // put a new line End Module