The Original Text File Content The output example Please use C++. Problem B: Lions, Tigers, Deer, an

The Original Text File Content

The output example

Please use C++. Problem B: Lions, Tigers, Deer, and Bats. It's a Zoo out there! (50 pts) You've been contracted by a local Zoo. They recently did an inventory of all their animals, by walking all over the zoo and placing the name of every animal they saw in a big file. To their horror, however, they found that this file has duplicate animals! This might just be an issue with their volunteers entering data, but they worry that this might be caused by animals that are in many different parts of the zoo, rather than all in one place. Worst case, this might be an indication that animals are escaping! Whatever the cause, they need your help to organize the file, and to count how many duplicates are in the file. Program Behavior Your job is to write a program that the zoo can use both this time, and in the future, to help them sort out their animal duplication problem! • Create a very large array to hold the animal file. – Since we don't know how big this array will be, make it 1000 long. The zoo says they will never have a file that big. • Prompt the user for the name of the animals file. – While we may only be giving you one or two files, your program should work with ANY appropriately formatted file, with any given name. • Open that file and read each animal in it, into the very large array, tracking the number of filled entries in that array. – If the file name is not openable, an error message should be printed, and the program should halt. • Using the array, count how many duplicates there are in the file: – a duplicate is defined as a line of text that lists an animal that has already been listed. – The first time an animal is listed it is not a duplicate. – If an animal appears twice that's 1 duplicate, not 2. – If an animal appears 3 times, it counts as 2, etc. • Write a new file named “animals_clean.txt” which contains all the same animals as the original file, without any duplicates listed. Additional restrictions, notes, and hints • For this problem there are no required functions, you are of course, free and encouraged to write other helpful functions as needed. – For all functions, required and not, remember to include a required comment before the function declaration that explains the purpose of the function. • Make sure you understand the “very large array” idea being used here before starting. This is not something you can expect to “figure out as you go”. • You are REQUIRED to use the “very large array” idea presented above in your solution. • Hints for developing programs with functions: – Fully design, implement, and test each function before starting main. This way you can write code in main that simply runs your function. You will need to develop your own tests during this part. – Don't start writing main until you are sure your functions work. – Use your functions as much as possible. These should make the main function itself relatively simple. Examples There are 3 “example” files online. This includes a test file, with MANY duplicates allowing you to better test your program's duplicate counting, the 2018 zoo inventory, which contains substantial data entry issues (lots of trivial duplicates) and the 2019 file which is close to perfect, but not quite. You will want to download all 3 files to the exact folder your c++ code is in for testing. We may test on these files, or on any other file of our choosing Make sure your code works for any input. You can also test on the animals_clean.txt file generated by your program, this should always have 0 duplicates. anaconda fox bison cougar sheep tamarin flamingo tortise giraffe tamarin gorilla kudu lemur lion orangutan ostrich monkey penguin bear puffin reindeer monkey lion seahorse sloth leopard monkey tiger wold zebra Example 3 Input file: animals_dictionary-2019.csv. Input animal file name: animals dictionary-2019.csv 4 duplicates detected Contents of animals_clean.txt after running the program anaconda fox bison cougar sheep tamarin flamingo tortise giraffe gorilla kudu lemur lion orangutan ostrich monkey penguin bear puffin reindeer seahorse sloth leopard tiger wold zebra

 

Looking for a Similar Assignment? Let us take care of your classwork while you enjoy your free time! All papers are written from scratch and are 100% Original. Try us today! Use Code SAVE15 for 15% discount