Objectives: The testing process consumes largeamounts of data. Creating test data is a crucial part of thetesting process especially for new systems which are not in useyet. This assignment will give you an opportunity to practice howto create large amounts of randomly generated test data givenparameters.
General Instructions: Read the problemdescription below and implement this program in C++.
- You will need to create 3 different batches of randomlygenerated test data.
- The data you create will be stored in 3 different txtfiles.
- Randomly create the data based on the given parameters andspecifications.
- You do not have to submit the txt files with your program. Theywill be deleted before the graders test your program.
Problem Description: A genetic scientist isconducting a variety of experiments on different species of animalsincluding rabbits, cats, and horses to trace the changes in color,length and pattern of the selected animals’ coat. The experimentsmust be repeated many times on a huge number of animals to ensureaccurate results. Usually the file size of these experimentsinclude thousands of entries. Conducting this type of experimentsis time consuming, and as a result the scientist has not conductedenough experiments nor collected enough data yet. The scientistaims to hire a computer programmer to automate the experiments.Your task is to write a C++ program to automate these experiments.The major challenge, for you as a programmer, is the lack of theactual data. Due to lack of data, you were asked to create somedata to be used for the experiment.
First, you need to create data about rabbit coats and save thisdata in a separate txt file. Rabbit coats have many properties, butwe will only focus on the following 5 properties:
- A: Agouti hair shaft pattern
- B: Black (or chocolate)
- C: Complete color
- D: Dense color
- E: Extension of color
The different options for these properties are denoted byuppercase and lowercase letters. So for example a rabbit mighthave: AaBBCcddEE as its genetic code. The uppercase letters areused for dominant genes while the lowercase letters represent therecessive genes. If the first letter is recessive, the secondletter cannot represent a dominant gene. You need to create 1000entries for this dataset.
Second, you need to create data about cat coats and save thisdata in a separate txt file. The data about this type of coats isas follows:
- Length: Short, medium, long, or hairless. Will be representedwith 1 character (S, M, L, H)
- Color: White, Black, Red, Blue, Cream, Brown, Cinnamon. Will berepresented with 2 characters (WH, BA, RE, BU, CR, BR, CI)
- Pattern: Solid, Tabby, Bicolor, Calico(tricolor),tortoiseshell, colorpoint. Will be represented with 2 characters(SO, TA, BC, CA, TS, CP)
- Extra properties: Tipped, Shaded, Smoked. Will be representedwith 2 characters (TI, SH, SM)
So for example, a cat’s color code might be M-BA-SO-SH. For thisdataset, you will need to include the cat’s birthday with its colorcode (for example“M-BA-SO-SH 09:10:2016”).The birthdays can be any day in 2016. Make sure you take intoaccount the number of days in a month. This dataset needs tocontain 2000 entries.
Lastly, you need to create one more text file that holds dataabout 3000 horses. This dataset will include the followinginformation about horses:
- Name: All capital letters, string of random letters between 6and 14 characters.
- Age: Random number between 2 and 10.
- Coat color: Black, Chestnut, White, Gray, Liver, Seal brown.Will be represented with 1 character (B, C, W, G, L, S)
- Coat pattern: Leopard, Appaloosa, Pinto. Will be representedwith 1 character (L, A, P)
- Other markings: Leg, Facial (L, F). A horse can have one, both,or none of these markings.
So for example a horse’s data will look like:OECDTPXNLAE 2CLLF
Hint: Random data is created using the rand() functionavailable. You can use the modulus operator (%) after rand,followed by a number that represents max, the compiler will outputan integer larger than 0 and less than max. Your code will looklike int x = rand() % 5; which will give you either 0, 1, 2, 3, or4. In order to make the output of the rand function really random,we need to set the seed to null. The rand function is basically acounter that constantly counts from 0 to max and depending on whenit’s called, it returns the integer. That is why it isn’t veryuseful for large max numbers. If you output 5 rand numbers thatrange between 0 and 100 in one function, you will get increasingnumbers. In order to be able to set the seed to null, you need toadd the following to the beginning of the main function once:
You also need to include a couple libraries so the compilerknows the srand, time and rand functions:
#include<time.h> //for time
Once you have these steps complete, you should be able to callthe function mentioned above and use the rand function to generaterandom numbers which is required for this assignment.
Sample Rabbit: AABbCcDdee
Sample Cat: L-CR-SO-SH 02:11:2016
Sample Horse:SVTWJCLWT 4WLLF
Answer to Objectives: The testing process consumes large amounts of data. Creating test data is a crucial part of the testing proc…