[nfbcs] C++ Assignment Help

Lanie Molinar laniemolinar91 at gmail.com
Fri Oct 27 07:12:29 UTC 2017


I think that just made things worse. Take a look at the attached log now.


On 10/27/2017 2:06 AM, Jim Barbour wrote:
> So, one thing you should do is start with
>
> int count = 0;
>
> instead of
>
> int count = 1;
>
> I think that will fix you up.
>
> Jim
>
> On Fri, Oct 27, 2017 at 01:34:01AM -0500, Lanie Molinar via nfbcs wrote:
>> Hi, everyone. Thanks for trying to help me a couple days ago. I still didn't
>> understand what I needed to do after you tried to help, but not long after
>> that, I was able to find a tutor, and she helped me a lot. Now, I have a
>> question about another assignment, and I think this one even has my tutor
>> stuck. I'm working on a program that prompts a user for the number of days
>> in the month and the offset from Monday for that month, and then displays a
>> calendar table. It's a lot like the calendar I wrote the pseudocode for in
>> the assignment before this. It's almost complete, but the spacing of the
>> numbers in the first row is off by 4, and I don't know how to fix it. I've
>> tried several things, and my tutor has suggested some things, too, but
>> nothing fixes it. My professor says this is probably the hardest assignment
>> of the semester, and I can definitely see why. Can you please take a look at
>> my work and let me know if you have any suggestions? I'm attaching my work,
>> my log from PuTTY that shows the expected output, and the assignment
>> instructions. Thanks.

-------------- next part --------------
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2017.10.27 02:10:09 =~=~=~=~=~=~=~=~=~=~=~=
Using username "living4god1991".
living4god1991 at 157.201.194.201's password: 
Last login: Thu Oct 26 22:57:29 2017 from 67.44.193.75

[living4god1991 at LinuxLab01 ~]$ testBed cs124/assign25 assignment25.cpp

a.out:

------------------------------------------------------------
Starting Test 1

This first test is the simplest case. Here the offset from Monday
is zero so we start on Monday

   > Number of days: 28
   > Offset: 0
   >   Su  Mo  Tu  We  Th  Fr  Sa
   >    1   2   3   4   5   6   7\n
Exp:        1   2   3   4   5   6\n
   >    8   9  10  11  12  13  14\n
Exp:    7   8   9  10  11  12  13\n
   >   15  16  17  18  19  20  21\n
Exp:   14  15  16  17  18  19  20\n
   >   22  23  24  25  26  27  28\n
Exp:   21  22  23  24  25  26  27\n
   >       
Exp:   28\n

Test 1 failed.
------------------------------------------------------------

------------------------------------------------------------
Starting Test 2

This is another simple case. The offset from Monday is 3 so
the first day of the month must be Thursday.

   > Number of days: 30
   > Offset: 3
   >   Su  Mo  Tu  We  Th  Fr  Sa
   >                1   2   3   4\n
Exp:                    1   2   3\n
   >    5   6   7   8   9  10  11\n
Exp:    4   5   6   7   8   9  10\n
   >   12  13  14  15  16  17  18\n
Exp:   11  12  13  14  15  16  17\n
   >   19  20  21  22  23  24  25\n
Exp:   18  19  20  21  22  23  24\n
   >   26  27  28  29  30\n    
Exp:   25  26  27  28  29  30\n

Test 2 failed.
------------------------------------------------------------

Here we will be testing the case when the offset is 6. A common
mistake is to have a blank line at the beginning of the calendar.
In order to get around this, you need a special condition (an IF statement)
that checks for offset == 6 and handle that case.

------------------------------------------------------------
Starting Test 3

   > Number of days: 31
   > Offset: 6
   >   Su  Mo  Tu  We  Th  Fr  Sa
   >                            1\n
Exp:    1   2   3   4   5   6   7\n
   >    2   3   4   5   6   7   8\n
Exp:    8   9  10  11  12  13  14\n
   >    9  10  11  12  13  14  15\n
Exp:   15  16  17  18  19  20  21\n
   >   16  17  18  19  20  21  22\n
Exp:   22  23  24  25  26  27  28\n
   >   23  24  25  26  27  28  29\n
Exp:   29  30  31\n
   >   30  31\n
Exp: No output

Test 3 failed.
------------------------------------------------------------

------------------------------------------------------------
Starting Test 4

Here is another special case. Since the last day of the month also happens
to be the last day of the week, it is a common case to put an extra blank
line in the output. In other words, you put a newline in the output when
the day of the week is Saturday, and you put a newline in the output when
we get to the end of the month. You will need a special condition to check
that you are not on a Saturday when you display the end of the month newline

   > Number of days: 30
   > Offset: 4
   >   Su  Mo  Tu  We  Th  Fr  Sa
   >                    1   2   3\n
Exp:                        1   2\n
   >    4   5   6   7   8   9  10\n
Exp:    3   4   5   6   7   8   9\n
   >   11  12  13  14  15  16  17\n
Exp:   10  11  12  13  14  15  16\n
   >   18  19  20  21  22  23  24\n
Exp:   17  18  19  20  21  22  23\n
   >   25  26  27  28  29  30\n    
Exp:   24  25  26  27  28  29  30\n

Test 4 failed.
------------------------------------------------------------


============================================================
Failed 4/4 tests.
============================================================

[living4god1991 at LinuxLab01 ~]$ 


More information about the NFBCS mailing list