Assignment 03

Of course, when you start using this formula, you will need a LastNumber to start out with. Use 1111111. This formula will always give you a 7-digit number, and you are to assume it is a valid phone number (and not question how ridiculous this statement really is). Note: 8999999 is the range of the acceptable numbers, 1000000 is the minimum of acceptable numbers, 7919 is the awful Telemarketer Multiplier, 104729 is the dreaded Telemarketer Offset Value, and 15485863 is the hated Telemarketer Terrifier Index.

Once you generate a phone number, your program must "decide" the outcome of a fictitious calling of that number, thus simulating reality. Do that in this way: Compute PhoneNumber mod 3. If the the result is 0, this will mean the number was busy; if the result is 1, it means no answer; and if the result is 2, assume the call was answered. And, if the call was answered, assume that a sale was made only if the last two digits of the PhoneNumber give a value bigger than 75. For example, suppose the PhoneNumber you generate is 1234577. Then the result of mod by 3 is 2, indicating that the call was answered. And since 77 (the last two digits) is greater than 75, a sale was made. Each time a number is called, output the number (one per line). If the call resulted in a sale, follow the number (on the same line) with "......a sale was made" or something equally informative. Here's a sample of pretty output.

Calling 7493693...Sale made at phone number 7493693

Calling 1832580...

Calling 3052118...

Calling 3880892...Sale made at phone number 3880892

Calling 9936285...

Calling 2875741...

Calling 9879098...Sale made at phone number 9879098

Calling 5587779...

Calling 7616039...

Calling 1567049...

Calling 6389497...

Calling 7217051...

Calling 1097129...

Calling 1700137...

Calling 7274685...

Calling 1924884...

Calling 6171933...

....

Continue making calls and tallying the results until you have made 300 calls or have 30 sales, whichever comes first. Then output the stats mentioned above.

PhoneNumber = [( LastNumber * 7919 + 104729) mod 15485863] mod 8999999 + 1000000

Details: Now, since there really is no marketing firm giving you numbers, your program is going to create those phone numbers (in the same way that the marketing firm would anyway). Thus, each time you simulate the calling of a number, you use this formula:

Due: Friday, Feb. 12, 2015 at noon 100 points

For this assignment, you will submit a single C++ compilable file containing a program written in C++. Remember, to submit a file for this course electronically, from the directory in which the file resides type in at the UNIX prompt the command: cssubmit 1570 section_letter assignment_number. Be sure that only the file you want to submit is in that directory - make a directory for every assignment! The submit system will deliver every .cpp file in the current directory to me. Name your file a meaningful name and give it a .cpp extension since you will be compiling it. Also, make sure that you compile and run your program using the GNU (g++) compiler before submitting to make sure that it will work for the submit script.

Background: You have all had to deal with telemarketers, and I am sure that your dislike for them and their craft is no less than ours. But you probably don't know that telemarketing is an integral (even calculus is involved) part of sales engineering, something that our hero Cletus is getting involved in. He has accepted a job with a telemarketing firm as a "Marketing Engineer Level 9", making hundreds of mindless calls each day. You, on the other hand, will write a program to simulate the same process.

Specifications: Your program is to simulate the calling of phone numbers (that normally would be given to you by the marketing firm). The program is to count the number of calls made, the number of calls that connect (answered), the number of answered calls that make a sale, and the number of answered calls that don't make a sale. At the end of the program, you are to output these aforementioned values, and output the overall effectiveness of the exercise which is the percentage of successful sales for the total number of calls made.

As always, if you have any questions about this assignment, be sure to ask your cs 1570 instructor. Please don't ask help from your cs 1580 (lab) instructor as this is not their assignment.

When you submit: There is no input for this program, so you just have to submit as usual.

If you are bored: You can make slight modifications to this program such as

  • output the successful calls (resulting in a sale) in the normal format: 123-4567

  • figure out a way to generate random phone numbers using a modified version of the formula above but modified so that you get numbers only with one of the three exchanges 341, 364, or 308.

  • likewise but with one of 5 area codes: 314, 417, 819, 202, or 619.

Having completed this assignment, you can let Cletus use it so that he and Brandine can spend their lives in leisure.....on the front porch....eating skunks.