CMPS 3350 Lab-15

Program writing and testing methods

Written homework for Wednesday:
This is written homework, not coding homework.
Do not write code.
Write statements or sentences that can be read by a person.
This is graded work.
You graduated and started your own software development company. Your company
needs to provide this critical solution to a large customer, and the product
must work perfectly.

List all the ways that you could test this program. You may display your list
neatly in program comments near the top of the bigadd program.

You may also list your methods in a file named: 3350/f/testing.txt

You may also write your items on paper and hand it in just before class begins.

Your instructor, Gordon, has thought of 10 ways to test this software. Earn
extra points by matching one of Gordon's testing methods. Earn big points by
being the only student to list one of big G's testing methods.

Step-1:
Do your work in your own Odin 3350/f/ folder.

You may get a starting framework at the following location...
    /home/fac/gordon/p/3350/code/lab15/bigadd.cpp
    /home/fac/gordon/p/3350/code/lab15/Makefile

Task...

Your software company needs to provide this critical solution
to a large customer, and the product must work perfectly.

Write a C or C++ program that will...

  1. Generate some rows of numeric digits.
     Use the random number generator.
  
  2. Ask the user for the number of rows and columns of digits.
     2x4 might look like this... 

     6580
     5026

  3. Treat each row of digits as a number. Show the sum using addition.
     Example:

     6580
     5026
     ----
    11606

Program output will look something like this...
Lab-15 number addition ---------------------- Enter rows & columns: 2 5 13463 75385 ----- 88848 program complete.
You may also get user input using command-line arguments. Note: Students who work alone on this assignment have the potential to earn a higher score than students who work in groups.

Step-2:
As you start to get this working, think of how you might go about
testing the program functionality. You need a testing method because
the user might enter 15x60 and the output would look like this...

   098518475729937943702295710063362216273777860564054596069385
   623166786073059027745394923071735061951588885987972613227534
   920456842112010500518779221096689656550961182164318107229649
   419596141130468896337149894058991051767003069159784718619014
   126233529521838963833226397211945590842995390196691124775416
   701570556878507716596600079530433780938535505398149919138213
   376846832605368019844767872823250056739122878681667263963155
   792917680794182162240066575812381792473774184503747046625306
   566836385872401163457354146798374270828505877185441398714506
   453870873835512342806136239889424714011524077523933647480578
   613216617869489253556133091048020341914912050198573108407603
   625689992303511822671111973655928408507850311615175486895171
   783743595491454535344894693100278742313863100583238619078500
   758524956564896076399182209262337319727575974871433441691819
   045978872720449929282528819211137827624908142256185559642563
   ------------------------------------------------------------
  7807168139503088354335621846634290832466898490890366651558412

Is this correct or not?
How could you verify this answer?

Include in your program comments near the top of the source file a list of
ways you can test this program. List as many ways as you can think of to
get this program tested. Your job depends on it.

Number your testing methods. You may list them as a to-do list if you want.
Think of as many as you can.

Step-3:
Suggestions in writing this program...

  1. Setup an array to store the sum.
  2. As each random digit is generated, add it to the sum, then display it.
  3. Think about elementary school addition.
  4. Use carrying. This will require modulus and division operations.
  5. Start with 2-rows and 1-column for easy visual testing and easy debugging.

An important part of this assignment is listing as many ways as you can think
of to test this program. It has to work perfectly.

You should include a simple unit-test in your code. You may isolate it with
preprocessor directives and a second executable, if you know how. It is a
required component for a high lab score.

Notes:
Your files will be collected at lab end, 12:30pm.
Please make sure your program compiles and runs.