1. Project Description

a. Project Synopsis:

In this project you will write a program called num_stat for computing various statistics about given input values.  The program will print out the following statistics about the input:

i. All the integer factors.

ii. Which integer factors are prime.  For example, the factors of the number 8 are: 8, 4, 2, and 1.  Those that are prime (greater than 1) are only divisible by themselves and one.  For 8, there is only one prime factor: 2

iii. If a number is odd or even.

iv. If a number is perfect square.  For example, 16 is a perfect square of 4.

b. Coding Standard (5 points):

All code shall follow the Coding Standard (http://goo.gl/am5cxS).  Note: There is no explicit requirement ID for this part.

c. Algorithm Outline (10 points):

i. R02_001: Read section 2.d. below to understand the program requirements first.  Using a C style comment block (/* */) immediately below the File Header Comment Block of your num_stat.cpp file, write a structured outline in english for the algorithm that your program will use. Be sure your outline clearly defines the details of the steps and any loops that your algorithm will use to accomplish the objectives.  Hint: Write this like you would write a document outline.

ii. R02_002: Be sure your outline includes a description of any functions (outside of main()) that your program will call.

d. Program (35 points):

i. R02_003: The program shall read 5 integer values from the command line.

ii. R02_004: The program shall verify that each value is a positive integer or else print an error message, for that value only, but still process other correct values.

iii. R02_005: The program shall have a function for computing and printing the integer factors for a single given value.

iv. R02_006: The program shall have a function for computing and printing if a single passed in integer value is prime or not and return a single bool

as such.  The calling function shall print out based on the return value.

v. R02_007: The program shall have a function to compute whether or not a value is odd or even and return a single bool as such.  The calling

function shall print out based on the return value.

vi. R02_008: The program shall have a function to determine whether or not a value is a perfect square and return a single bool as such.  The calling function shall print out based on the return value.

vii. R02_009: Run your program and paste the output to the bottom of the cpp file with the following input values:

1. 0 1 2 3 4

2. ­1 9 81 82 80

3. 3 5 7 9 21

4. 100 0 0 0 0

2. Deliverables

a. The “fact.cpp” file created in section 2.c. and 2.d. above.

    • 8 years ago
    Best Answer
    NOT RATED

    Purchase the answer to view it

    blurred-text
    • attachment
      num_stat.zip
    • attachment
      output.docx