Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

f5. l.'F'|l'-Z'.|f'lii'-' 1.'I.':- |:-r|1.-1 ITE :5.Il':lr'J| II'I.':I.J:T '-.-:'-'-:'T-:'.It I'I .-';I'Ij !'I'-.-'I '_ EI'iTil-r 1TH:2 I':I:-I'iIJ -:'i'I-':-':':~'_': in the main function display and process a menu

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
\f5. l".'F'|l'-Z'.|f'lii'-' 1.'I.':- |:-r"|"1.-"1" ITE :5.""Il':lr'J| II'I.':I.J:"T '-."-:'-'-:'T-:'.It" I'I .-';I'Ij !'I'-.-'I '_ EI'iTil-r" 1TH:2 I':I:"-I'iIJ -:'i'I-':-"':':~'_': in the main function display and process a menu for adding animal records. displaying a list of all animal records. searching for an animal, and displaying a list of only the endangered animals. The menu must also have an option to exit the program and must handle invalid input options. Any invalid input must redisplay the main menu. When the user decides to quit the program, the program must clear the vector before exiting the program. The program must also close any open text or binary le. . .I'irl-:J .inime ' W " Tu". Function to Add animal records {See example screenshots below}: There are two changes to this function; I When the user adds a new animal. the user must also select the species of the animal. The names to be used in the menu were the names read into the string vector from the text file at the start of the program. The code must assure that the user enters in a valid menu item. If they do not, the code must display the appropriate error message and loop until the user enters in a correct value. - When the user enters in a new animal, the code must not only add the animal to the vector. but it must also store the animal in the binary database "animaldat". This new data must be stored in the file in sorted order. \fa Function to search for an animal by name {see example screenshots below}: c There are several changes to this function :- Once the code nds the match, the code must aslc the user if the user wants to update the information about the animal. a: The code must ask a yesi'no question. Only '1", y, N or n are acceptable answers. Any other entry should display an appropriate error message and require the user to reenter. This must continue until the user enters a 1.ralid entry. :- If the user select that they do notwant to update the information, the function ends. I If the user does want to update the information. the code must ask the user for the name, species, and count {exactly the same as the add animal including the 1lralidations]. NOTE: I will never change the name of the animal when Itest the code. - The function must call another function to save just that specic record to the \"animaldat\" binary data le using Random Access Member functions only. a: The function to save the record must use the following Random Access Member functions: a .mkeil o eeekpii o .readi} o .writef} :- The prototype for this function is: o yoid updateHecordi'fstream, Animal, Animal}; o The fstream is the nal object o The rst Animal is the existing animal data o The second Animal is the newr updated animal data 1E1 Function to display endangered animai records {See example screenshcts below}: There is no change- tn this lnctinn frnrn l 3h 5' The onlyr nding that must be done with this function is to x any deductions from Lab 2. Notes: a All constant names must be uppercase and multi word constant names must be separated with an underscore: Ex. SIEE Ex. SALES_TAX 4 There must be NO hardooded values anywhere in the code. including in the menu output. 4- All variables must be initialized. o All input data must be validated. That includes checking that the animal entered is not already in the database when the animal is added as a new animal. 4- The code must use vector functions only throughout the code. There must be NO array notation anywhere in the code. The following functions should be used in the code: a _size{} a .pu sh_back{} c .at{} o cleari} a Range based for loop I When you are testing your code, you should clear out delete your updated \"animatdat\" tile and make sure you are using the download oopy. lWhen it is read in, the "animal.dat" tile should have exactly 14 animals in the database. - The species le should not be updated at any time in the code. This is strictly a readonly text tile

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

Students also viewed these Programming questions

Question

=+ d. Calculate disposable personal income.

Answered: 1 week ago