Table of Contents

Corning Community College

CSCS1320 C/C++ Programming

PROJECT: MENTAL MATH - SQUARES OF FIVE (SOF0)

OBJECTIVE

To begin our exploration of programming, starting with an investigation into the various data types available in C, along with their properties, and collaboratively authoring and documenting the project and its specifications.

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

OVERVIEW

Your task is to write a program that performs the mental math technique of squaring any 1-, 2-, or 3-digit number that ends in a 5.

Contributing to project documentation is also a core part of this project. If from reading the existing documentation or through your own exploring, you find something lacking, unclear, or outright missing, that is an opportunity to potentially contribute content.

You want the project documentation to provide you (as if coming in with no awareness of the project) with sufficient information so as to allow you to proceed. Asking questions on the discord is a great way of getting more information that you can use to add content.

EDIT

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

BACKGROUND

This program will focus on a simple mental math trick: calculating the square of a multiple of 5.

This trick works with any multiple of 5 up to three digits (5 to 995), and can be done without much difficult math or a calculator.

Let's take an example number: 105. To calculate the square of 105, we can split the number into two parts, then perform a set of calculations on each part, in order to get our answer.

The two parts we want to split our number into are as follows:

  • The “back” part of the number, which is the 5 at the end of the number (this will be the case for every number).
  • The “front” part of the number, which is the digits before the 5. (In this case, it is 10).

Calculating the back portion is easy, we just need to multiply 5 by itself to get its square:

5 * 5 = 25

To calculate the front portion, we take our number (10), add one to it, and multiply these two values together to get the front portion of the answer:

10 * (10 + 1) = ?
10 * 11 = ?
10 * 11 = 110

Finally, we bring the two portions back together to get our answer:

110 25
11025
105 * 105 = 11025

SPECIFICATIONS

PROGRAM

OUTPUT SPECIFICATIONS

VERIFICATION

In the project files that you grabbed, there is a reference program, “ref.sof0.x86_64”, that you can run to verify your program.

This reference program will run a version of sof0 similar to what you will be creating, where you can enter a multiple of 5, and it will output its square.

You can use this reference to check the output of the program you will be writing, along with the format of the output.

 

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 (assuming you have a program called uom0.c):

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:sof0:final tally of results (39/39)
*:sof0:used grabit to obtain project by the Sunday prior to duedate [6/6]
*:sof0:clean compile, no compiler messages [7/7]
*:sof0:program conforms to project specifications [20/20]
*:sof0:code tracked in lab46 semester repo [6/6]

Pertaining to the collaborative authoring of project documentation

Additionally