Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Wildlife Zoo is considering new radio frequency identifier (RFID) chip technology to track the animals in their care. However, the tracking technology that they are

Wildlife Zoo is considering new radio frequency identifier (RFID) chip technology to track the animals in their care. However, the tracking technology that they are looking at stores data on the animals but does not allow for maintenance. Wildlife Zoo would like a prototype, or preliminary model, built of a system that will interface with the tracking system and allow for maintenance of their animal data.

Therefore, Wildlife Zoo has decided to execute a proof of concept (POC) pilot project to test that their system integration and design concepts are feasible and that they will deliver the overarching functionality they require. Chada Tech was awarded the POC contract to build the prototype.

You are doing a fabulous job at Chada Tech in your new role as a junior developer. You exceeded expectations in your last assignment for Airgead Banking. Since your team is impressed with your work, they have given you another, more complex assignment. Some of the work for this project has already been completed by a senior developer on your team. You have been given the Java class for writing to a file and the C++ code to link to the Java class. Your task is to build a prototype interfacing system for Wildlife Zoo in C++ that incorporates all of their requested functionality.

The following is a high-level overview of the interface system. The user will interact with the C++ component, specifically the user menu that you will create. The C++ component will call Java functions to allow for user input.

image text in transcribed

Directions

You will write a multiclass C++ interfacing prototype system for Wildlife Zoo that incorporates Java for certain functionalities.

  1. Open the Virtual Lab by clicking on the link in the Virtual Lab Access module. Using the Uploading Files to Eclipse Tutorial, upload the zipped folder into the Virtual Lab. Both of these pieces are located in the Supporting Materials section. Then create your project in the integrated development environment (IDE). NOTE: Make sure to create your project from TheZoo folder. It should appear to be a C++ project with Java files.
  1. Review the existing code that you have been provided:
    • TheZoo.cpp: C++ code that links to the Java class using JNI
    • ZooFileWriter.java: Java ZooFileWriter class which allows the user to write to a file
  1. Follow the Wildlife Zoo Interface Guide, located in the Supporting Materials section. These requirements describe the C++ code that you will be creating for the interface, which will include:
    • User Menu
    • Generate a File (this code has been created for you; you will simply need to run this function)
    • Loading Data
    • Displaying Data
    • Adding a Record
    • Deleting a Record
    • Saving Data
  1. Remember that you must demonstrate industry standard best practices in all your code to ensure clarity, consistency, and efficiency. This includes:
    • Input validation and error handling to anticipate, detect, and respond to run-time and user errors
    • Inserting in-line comments to denote your changes and briefly describe the functionality of the code
    • Using appropriate variable, parameter, and other naming conventions throughout your code

C++ code Provided

=====================================================

#include #include using namespace std;

void GenerateData() //DO NOT TOUCH CODE IN THIS METHOD { JavaVM *jvm; // Pointer to the JVM (Java Virtual Machine) JNIEnv *env; // Pointer to native interface //================== prepare loading of Java VM ============================ JavaVMInitArgs vm_args; // Initialization arguments JavaVMOption* options = new JavaVMOption[1]; // JVM invocation options options[0].optionString = (char*) "-Djava.class.path="; // where to find java .class vm_args.version = JNI_VERSION_1_6; // minimum Java version vm_args.nOptions = 1; // number of options vm_args.options = options; vm_args.ignoreUnrecognized = false; // invalid options make the JVM init fail //=============== load and initialize Java VM and JNI interface ============= jint rc = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args); // YES !! delete options; // we then no longer need the initialisation options. if (rc != JNI_OK) { // TO DO: error processing... cin.get(); exit(EXIT_FAILURE); } //=============== Display JVM version ======================================= cout GetVersion(); cout > 16) & 0x0f)

jclass cls2 = env->FindClass("ZooFileWriter"); // try to find the class if (cls2 == nullptr) { cerr GetStaticMethodID(cls2, "createZooFile", "()V"); // find method if (mid == nullptr) cerr CallStaticVoidMethod(cls2, mid); // call method cout

jvm->DestroyJavaVM(); cin.get(); }

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; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions