Project 1: CISC181, Spring 2004

Required Reading/Concepts:

Chapters 1-3 in Deitel, including

Selected pages from Chapter 4 in Deitel:

Reminders:

Assignment Description

This assignment involves developing a "Computer Aided Instruction" program that might be useful, for example, for an elementary school student learning basic arithmetic: addition, subtraction, multiplication, and division.

Your Deitel textbook contains several exercises that guide you, step-by-step, through the development of such a program, over the course of six small exercises. With each exercise, you add more and more feature to the program, until you have a finished product that has lots of sophisiticated capability.

I recommend that you follow that step-by-step approach. Over the course of the project, you will develop six versions of your program, adding features each time. Note that in the end, you should submit only one program, not six programs. However, each of the intermediate steps represents a working program that you can submit for partial credit. (The maximum grade you can earn by submitting each "partial program" is indicated at each step.)

Resist the temptation to just jump immediately to the final program. Experienced programmers will tell you that step-wise refinement is a smart approach. It is easier to develop a large sophisticated program if you do it in a set of phases, where at each phase you have a working, complete program for that phase.
On the other hand, it it probably best to read over the entire assignment before starting to code part 1, so you have some idea of where we are going. But don't let the size or complexity overwhelm you; working step by step, one step per day, you'll have no trouble finishing on time if you start NOW. So, with that advice, let's begin:

Step 1: Simple Multiplication

Complete DD exercise 3.35, p. 245. This is a program that generates multiplication problems that an elementary student might have to solve, for example:

What is 6 times 7?

The student must enter the correct response. She/he is asked the question repeatedly until she/he gets it right.

(NOTE: See your Deitel text for more important details; don't just rely on the brief explantion here.).

Additional problem requirements:

Hints:

Partial Credit: If this step is as far as you get, it is worth up to 60% partial credit (you start with a grade of 60%, and additional deductions may be taken from there). If you stop here, script this program. Showing at least two runs: show that the srand(time(0)); seeding is working correctly, and show both correct and incorrect responses. Submit both a script p1s1.txt and your C++ file p1s1.cpp or p1s1.cc. If you are continuing on with the remaining parts, you do NOT need to submit a script or C++ program for this step.

 

Step 2: Simple Multiplication with Random Feedback

Complete DD exercise 3.36, p. 245. This exercise adds "random feedback" to your assignment from step 2.

Start by making a copy of your p1s1.cpp or p1s1.cc program with, for example:

cp p1s1.cpp p1s2.cpp


Then, in the place where you had

cout << "Very good!";

replace this with the following function call:

printRandomPraise();

This function should have the prototype:

void printRandomPraise(void);

and should contain code that chooses a random value between 1 and 4, and then uses a switch statement to print one of the four sample messages of praise contained in your book. Note that since the function takes no parameters, it has (void) in the parentheses, and since it doesn't return anything (it just prints stuff out), it has void as the return type.

Then do something similar for the line of code that prints the message "No. Please try again." You can some up with your own name for this function.

(NOTE: See your Deitel text for more important details; don't just rely on the brief explantion here.).

Additional problem requirements:

Partial Credit: If this step is as far as you get, it is worth up to 70% partial credit (you start with a grade of 70%, and additional deductions may be taken from there). If you stop here, script this program. Showing at least two runs: show that the srand(time(0)); seeding is working correctly, and show both correct and incorrect responses. Submit both a script p1s2.txt and your C++ file p1s2.cpp or p1s2.cc. If you are continuing on with the remaining parts, you do NOT need to submit a script or C++ program for this step.

 

Step 3: Monitoring Progress

Complete DD exercise 3.37, p. 245. This exercise adds progress monitoring.

Start by making a copy of your p1s2.cpp or p1s2.cc program with, for example:

cp p1s2.cpp p1s3.cpp

Then follow the instructions in your Deitel text to make the necessary changes for this step.

Partial Credit: If this step is as far as you get, it is worth up to 80% partial credit (you start with a grade of 80%, and additional deductions may be taken from there). If you stop here, script this program. Showing at least two runs: show that the srand(time(0)); seeding is working correctly, and show both correct and incorrect responses. Submit both a script p1s3.txt and your C++ file p1s3.cpp or p1s3.cc. If you are continuing on with the remaining parts, you do NOT need to submit a script or C++ program for this step.

 

Step 4: Adding grade level

Complete DD exercise 3.47, part (a), p. 248. This exercise adds grade level capability.

Start by making a copy of your p1s3.cpp or p1s3.cc program (by now, you can figure out the command.)

Then follow the instructions in your Deitel text to make the necessary changes for this step. In addition, do the following:

Change the format of the output to match the following examples:

Example of grade 1 output:


What is the answer to the following problem? 5 x 4 ===== Give your answer here:

For a grade 3 problem:

What is the answer to the following problem? 501 x 421 ======= Give your answer here:

 

Partial Credit: If this step is as far as you get, it is worth up to 90% partial credit (you start with a grade of 90%, and additional deductions may be taken from there). If you stop here, script this program. Showing at least two runs: show that the srand(time(0)); seeding is working correctly, and show both correct and incorrect responses. Submit both a script p1s4.txt and your C++ file p1s4.cpp or p1s4.cc. If you are continuing on with the remaining part, you do NOT need to submit a script or C++ program for this step.

Step 5: Adding addition and subtraction

Complete DD exercise 3.47, part (b), p. 248, for addition, subtraction, and multiplication only.

This exercise adds capability to choose not only grade level, but also which type of problem. For this step, we will add only addition and subtraction only (division will be a separate step; the final one.)

Start by making a copy of your p1s4.cpp or p1s4.cc program (by now, you can figure out the command.)

Then follow the instructions in your Deitel text to make the necessary changes for this step. The format is the same as previously, except use + or - in place of the * symbol in formatting the problems. You should be able to use the same code, but just use a switch statement to determine whether to print out +, -, or *.

Partial Credit: If this step is as far as you get, it is worth up to 95% partial credit (you start with a grade of 95%, and additional deductions may be taken from there). If you stop here, script this program. Showing at least two runs: show that the srand(time(0)); seeding is working correctly, and show both correct and incorrect responses. Submit both a script p1s5.txt and your C++ file p1s5.cpp or p1s5.cc. If you are continuing on with the remaining part, you do NOT need to submit a script or C++ program for this step.

 

Step 6: Adding division

Complete DD exercise 3.47, part (b), p. 248, for addition, subtraction, and multiplication and division.

Start by making a copy of your p1s5.cpp or p1s5.cc program. Call the new program proj1.cpp or proj1.cc.

Then follow the instructions in your Deitel text to make the necessary changes for this step.

Some additional instructions:

What is the answer to the following problem?

      
        +-----------	  
      12| 976
	
	Give your answer here: 81
   remainder: 4

   

To turn in: If you complete this step, you can earn full credit: you start with a grade of 100%, less any deductions. Showing enough runs to show that all the capabilities of the program work correctly. Submit both a script proj1.txt and your C++ file proj1.cpp or proj1.cc.

 

(end of project 1)