Assignment 07

Due: Wednesday, October 29, 2014 at noon 100 points

Instructions: You know how to submit; do it in the usual way. You will submit multiple files for this programming project. The cssubmit script will work as usual, picking up all .cpp and .h files in the current directory. So, make sure you have created a separate directory for your hw 7 program. (Do not create sub-directories in the hw7 directory.)

Background: Zombies are a problem. We've all had our run-ins with the walking dead; the horrible smell, the dull and half-witted conversations, and their propensity to stumble outside the white lines of a crosswalk are most annoying - ever hit one of those things? .... oh, what a mess! And what about the families? It's such a heart break when your loved one (a husband, a child, a grandmother) is suspected of zombie-ism. You take them to the doctor's office and no one wants to sit near you, what with all the drooling and mumbling and melting flesh. Downright embarrassing, I'd say. Recognizing the profound socio-economic impact that zombie-ism has on our culture, Dr. E. has begun focusing all of his considerable talents, skills, and resources on conquering this scourge. (The lesser important impacts of ebola, cancer1, and heart disease will just have to wait.) He has begun with the simple task of diagnosing the infection.

The standard method of diagnosis relies on somewhat subjective judgement calls: does the patient (1) have an urge to eat brains; (2) have a body-odor problem (either "slightly putrid" or the more extreme "rotten stench"); and/or (3) a pronounced tendency to shuffle or crawl. Experts understand that any one or two of these attributes can be explained away (the patient might work in a fast-food joint down south, or be drunk, or have poor hygiene), but all three definitely indicates zombie-ism. Dr. Eloe has found a new, and hopefully more accurate, method. It relies on DNA testing and pattern matching. DNA is comprised of nucleobases (guanine (G), adenine (A), thymine (T), or cytosine (C)). Zombies have the pattern GTAC in a particular sequence (i.e. part) of their DNA. So, he thinks that the presence of GTAC proves zombie-ism. But he's just not quite sure of his conclusion. So, he wants you to write a program to investigate the correlation. Your program will compare the diagnosis via physical indicators (bad body odor, craving for brains McMuffin on wheat, and a troubled gait) against the DNA evidence.

Specifications: Your program is to generate random people for the study. The number for the study is to be read in by the user and is not to exceed 5000. Each person will have (at least) the following attributes:

  • A DNA sequence of 128 characters (an array of chars, not a string or ntca)

  • a B.O. indicator (pleasant, neutral, slight putrifaction, or rotten)

  • a desire for brains, or not

  • gait - normal, shuffle, or crawling

The attributes of each person will be assigned at random. Please note that the characteristics of the physical behaviors are uniformly distributed. For example, each person has an equal chance of smelling pleasant, neutral, slightly putrid, or rotten, and the same is true for the other two attributes. However, DNA sequences, on average, contain characters in the following proportions: G's make up 30%, T's make up 23%, A`s make up 27%, and C`s make up 20%. Your data should reflect these facts.

Once your people have been created and endowed with their attributes, run the zombie tests on them - determine who has the (dreaded) GTAC pattern, and who has all three of the physical attributes that point to zombie-ism (slightly putrid or rotten smell, craving of brains-on-a-bun, and a gait that is shuffling or crawling). You will collect and report the percentage of people who satisfy each of the following conditions:

  • Want to eat brains

  • Have a slightly putrid or rotting stench smell

  • Do not walk normally

  • Qualify as zombies only by the external characteristics test

  • Qualify as zombies only by the DNA characteristics test

  • Qualify as zombies only by both the external characteristics test and the DNA test

Here is some sample output:

============= Welcome to Dr. Eloe's research study on Zombie-ism! =============

Enter the number of people in the test (1-5000): 5000

Out of a total of 5000 people tested:

50.42% want to eat brains.

49.64% have a slightly ripe or rotting stench smell.

66.78% do not walk normally.

9.66% qualify as zombies only by how they smell, how they walk, and what they want to eat.

33.16% qualify as zombies only by the DNA test.

6.14% qualify as zombies by both the DNA test and how they walk, how they smell, and what they want to eat.

We hope you found this research study interesting.

When you submit, have the program "operate" on an input of 5000 people.

As usual, if you have any questions, be sure to shuffle to your instructor's office and pick our brains for answers. But please take a shower before hand.

1This is National Breast Cancer Awareness Month. Have your loved ones schedule mammograms. Catch it early!