Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will write a multiclass C++ interfacing prototype system for Wildlife Zoo that incorporates Java for certain functionalities. Note : The Java file does not

You will write a multiclass C++ interfacing prototype system for Wildlife Zoo that incorporates Java for certain functionalities. Note: The Java file does not need to be modified. It is being attached for reference. Please see the bolded "TODO" in the C++ code below screenshots.

1. A user menu which displays the following options: Load Animal Data Generate Data Display Animal Data Add Record Delete Record Save Animal Data 2. Generate Data: Your supervisor has created this code for you in Java. In the C++ class you have been given, the createZooFile() function has been created for you. You should not modify the Java code. a. For this function, you should make sure the user menu calls the createZooFile() function when the user selects Generate Data from the menu. b. You will need to call this function and generate a file. When you are prompted for input, remember the following character limits: i. Track #: 6 characters ii. Name: 15 characters iii. Type: 15 characters iv. Sub-type: 15 characters v. Eggs: Integer vi. Nurse: Integer 3. Load Animal Data: a. In your zipped folders, you have been given a Java class that generates a fixed length file. It will prompt the user to enter data for the following fields: Track #: Received from the RFID chip technology Name: Name given to the animal Type: Oviparous (egg laying) or Mammal (primarily non-egg laying) Sub-type: Crocodile, Bat, Whale, and so on Eggs: Number of eggs laid Nurse: Should read 0 if the animal is not nursing, 1 if it is b. Data in the file will look like this. Column widths in the actual file will be fixed and are respectively 6 characters, 15 characters, 15 characters, 15 characters, and two integer columns.

c. You must give users the ability to load this data into memory via a vector within your system. Use the following UML class diagram to build your class hierarchy and inheritance. Notice the variables listed in the Animal, Oviparous, and Mammal classes. A text version is available on the last page of this document.

d. The message Load complete. will display after the data loads successfully.

4. Display Animal Data: Display data on the users computer screen in tabular format (presented in the form of a table with rows and columns). 5. Add Record: Provide the capability to add new animal records. a. When this menu option is selected, the application should prompt the user to enter values for the variables Track#, Name, Type, Sub-type, Eggs, and Nurse. i. Make sure to validate input. b. The user should have the ability to save or cancel the addition. 6. Delete Record: Provide the capability to delete animal records. a. Delete an animal record by Track# when the user selects the Delete Record option from the menu. i. Make sure to validate input. b. The user should be prompted to confirm the deletion before the record is removed from the system. c. The message Animal successfully deleted should display once the operation finishes. 7. Save Data: Permit the user to save modified animal data back to the input file, erasing the data that was previously there. The message Save successfully completed should display once finished.

C++ File:

void AddAnimal()

{

/*

TODO: Write proper code to add an animal to your vector (or array)

*/

}

void RemoveAnimal()

{

/*

TODO: Write proper code to remove an animal from your vector (or array. Remmber to re-allocate proper size if using array)

*/

}

void LoadDataFromFile()

{

/*

TODO: Write proper code to load data from input file (generated using JNI) into vector/array.

*/

}

void SaveDataToFile()

{

/*

TODO: Write proper code to store vector/array to file.

*/

}

void DisplayMenu()

{

/*

TODO: write proper code to display menu to user to select from

*/

}

int main()

{

GenerateData();

return 1;

}

Java function that needs to be called: only for reference.

public static void createZooFile() {

try{

String entermore = "Y";

FileWriter fw=new FileWriter("zoodata.txt");

BufferedReader reader =

new BufferedReader(new InputStreamReader(System.in));

String animalName,trackNumber,animalType,animalSubType,eggs,Nurse;

do

{

System.out.println("Track Number: ");

trackNumber = reader.readLine();

trackNumber = padLeft(trackNumber, 6,"0");

System.out.println("Enter Animal Name: ");

animalName = reader.readLine();

animalName = padRight(animalName, 15," ");

System.out.println("Enter Animal Type: ");

animalType = reader.readLine();

animalType = padRight(animalType, 15," ");

System.out.println("Enter Animal Sub-type: ");

animalSubType = reader.readLine();

animalSubType = padRight(animalSubType, 15," ");

System.out.println("Enter Number of Eggs: ");

eggs = reader.readLine();

System.out.println("Enter 1 if Nursing, 0 if not: ");

Nurse = reader.readLine();

fw.write(trackNumber+" "+animalName+" "+animalType+" "+animalSubType+" "+eggs+" "+Nurse);

System.out.println("Enter more data? (Y for yes)");

entermore = reader.readLine();

}

while (entermore == "Y");

fw.close();

}catch(Exception e){System.out.println(e);}

System.out.println("The file has been successfully created...");

}

}

UML Class Diagram:

image text in transcribed

Animal + name: string +TrackNum: Integer Oviparous Mammal + NumberOfEggs + Nurse Crocodile Goose Pelican Bat Whale SeaLion d. The message "Load complete." will display after the data loads successfully. 4. Display Animal Data: Display data on the user's computer screen in tabular format (presented in the form of a table with rows and columns). Animal + name: string +TrackNum: Integer Oviparous Mammal + NumberOfEggs + Nurse Crocodile Goose Pelican Bat Whale SeaLion d. The message "Load complete." will display after the data loads successfully. 4. Display Animal Data: Display data on the user's computer screen in tabular format (presented in the form of a table with rows and columns)

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

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions