Table of Contents

Corning Community College

CSCS1320 C/C++ Programming

PROJECT: Mental Math Fun (MMF0)

OBJECTIVE

To explore relational decision making, as applied to a mental math process.

GRABIT

To assist with consistency across all implementations, data files for use with this project are available on lab46 via the grabit tool. Be sure to obtain it and ensure your implementation properly works with the provided data.

lab46:~/src/SEMESTER/DESIG$ grabit DESIG PROJECT

Please study any provided code, comments, or supporting documents, and look up, experiment, and ask questions on aspects that you do not understand.

EDIT

You will want to go here to edit and fill in the various sections of the document:

MMF0

Process

Input value as short int (all four digits)
Obtain the last two digits of this input value

-In order to obtain the last two digits of this input value, you can create a new variable and set that to be the result of the input year variable, divided by the integer division remainder (%) followed by 100. This is because a four-digit number, divided by 100 will yield a remainder in the tenth's and / or hundredth's place. This decimal-place number will be what you are looking to use for the next steps in the project.

-For example: short unsigned int new = year % 100

Quarter the value

subtract 2000 from the given year, and then divide by 4 using the “/” sign.

NOTE: Use () to ensure the code does things in the order you want.

Add quartered value back to two digit year

Add quartered value (output of last sections equation) to the last two digits of the current year (output of first section).

Subtract best fitting multiple of seven
Look up day in table
Day Value
Monday 1
Day Value
Tuesday 2
Day Value
Wednesday 3
Day Value
Thursday 4
Day Value
Friday 5
Day Value
Saturday 6
Day Value
Sunday 7
Day Value
Sunday 0
Edge case: leap years

To find the edge case you have to check if there is a remainder when dividing the year by 4

SELECTION

if statements

if statements are written as “if (condition){ the thing you want to happen }

If the condition is not met, “the thing you want to happen” is skipped over.

else if

ELSE IF is put at the end of a IF statement. ELSE IF will first check if the condition of the original IF statement was met, if it wasn't met, It then prompts another IF statement

Example:

if (condition0) 
{
     If condition0 is met do this ....
} 
else if (condition1) 
{
     if condition0 isn't met and condition1 is; Do this ....    
}
else

ELSE is put at the end of a IF statement. ELSE will first check if the condition of the original IF statement was met, if it wasn't met, It then does something

Example:

if (condition0) 
{
     If condition0 is met do this ....
} 
else  
{
     if condition0 isn't met do this ....    
}
RELATIONAL OPERATORS
Operator Description
== is equal to
!= is not equal to
< greater than
> less than
< = less than or equal to
> = greater than or equal to

VERIFY RESULTS

To verify your results, ./mmf0verify

Remember to only use stdout to print the days of the week [EX: fprintf(stdout, “Monday\n”)]. If stdout is used for anything other than the days of the week, the mmf0verify will say you have a mismatch for every year, even if you get the correct day when you run your compiled code. If you want to print something other than the days of the week, use stderr.

 

SUBMISSION

To be successful in this project, the following criteria (or their equivalent) must be met:

Submit Tool Usage

Let's say you have completed work on the project, and are ready to submit, you would do the following:

lab46:~/src/SEMESTER/DESIG/PROJECT$ make submit

You should get some sort of confirmation indicating successful submission if all went according to plan. If not, check for typos and or locational mismatches.

RUBRIC

I'll be evaluating the project based on the following criteria:

39:mmf0:final tally of results (39/39)
*:mmf0:used grabit for project by Sunday prior to duedate [8/8]
*:mmf0:clean compile, no compiler messages [8/8]
*:mmf0:program performs mental math process [8/8]
*:mmf0:program output conforms to specifications [8/8]
*:mmf0:code tracked in lab46 semester repo [7/7]

Pertaining to the collaborative authoring of project documentation

Additionally