[nfbcs] Help with C++ Assignment

Lanie Molinar laniemolinar91 at gmail.com
Tue Oct 24 07:31:29 UTC 2017


Hi, everyone. I'm taking an online college course that's an introduction 
to software development and need a little help with an assignment. Some 
of you might remember me asking for help in the spring semester. I tried 
to take this class then but got too far behind because I tried to take 
two classes,which was too much with my health problems. I'm retaking it 
now and things are going a lot better, but I'm completely stuck on an 
assignment and having difficulty finding an available tutor, so I was 
wondering if anyone could help. For the assignment, I'm supposed to 
write the pseudocode for a calendar program that will show a calendar 
after the user inputs a year and month. I've got most of it figured out, 
but I have no idea how to display the table. I had to compute the offset 
to determine which day of the week the month starts on, and now I need 
to use that number to create the table with the month starting at the 
right place in the table, but I have no clue how to do that. I believe I 
should use a loop though. I'm also supposed to make sure there's a new 
line at the end of each week, but again, I have no clue how. I'm 
attaching the assignment instructions and my work so far. If anyone can 
give me a hint, I would really appreciate it. Thanks.
-------------- next part --------------
getMonth()
   PROMPT for month
   RETURN month

getYear()
   PROMPT for year
   RETURN year

isLeapYear(year)
   IF ()(year MOD 4 = 0) and (year MOD 400 NOT = 0()
      RETURN true
   ELSE
      RETURN false

numDaysInYear(year)
   IF isLeapYear(year))
      RETURN 366
   ELSE
      RETURN 365

numDaysInMonth(year, month)
   IF (month = 1 OR month = 3 OR month = 5 OR month = 7 OR month = 8 OR 
   month = 10 OR month = 12)
      RETURN 31
   ELSE IF (month = 2)
      RETURN 28 + isLeapYear(year)
   ELSE IF (month = 4 OR month = 6 OR month = 9 OR month = 11)
      RETURN 30

computeOffset(year, month)
   FOR (startMonth = 1 to startMonth < month, increment startMonth)
      SET numDays += numDaysInMonth(startMonth)
   FOR (startYear = 1753 to startYear < year)
      SET numDays += numDaysInYear(startYear)
   SET offset = numDays MOD 7
   RETURN offset

displayTable(offset, numDaysInMonth)
   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nfbnet.org/pipermail/nfbcs_nfbnet.org/attachments/20171024/47f56412/attachment.html>


More information about the NFBCS mailing list