Write the class files and a sample Driver class to test the code for the followi
ID: 3709835 • Letter: W
Question
Write the class files and a sample Driver class to test the code for the following: You are writing code for a veterinary office. Each human client has: A last name A first name An address A client ID number of visits outstanding Balance an array of Pets (aggregation) Each Pet has: A name An animal type A weight A date of last rabies shot (String) A date of last visit (String) Write at least one constructor methods and the toString ( ) method for each class. The toString( ) method for the Client class must concatenate on the the information for each Pet the client owns. (name, type and date of last visit) Write an equals( ) method for the client based on the client id. Write a compareTo( ) method based the client’s last and first name. Write a driver class that reads in data from a file to create an array of five Clients with all the fields, including the array of Pets. The driver will print each client’s information (along with each the pet name and type and date of last visit) . This list of Clients must be sorted by name. (Use the selection sort we did in class for the Student class). I have provided a data file for testing located on the Canvas site. File structure: First line: number of clients. Last name, first name, address, ID, number of visits, balance, number of pets Pet name, animal type, weight, rabies date, last visit date The fields in the file are comma delimited. Allow the user to search for the array of clients based on Client ID. You must use the Client equals( ) method for this. Once the client is found print that Client’s information. If the client is not found, print a message stating so. Continue allowing the user to search using a loop. Allow the user to add more pets for a client. Since these are high-quality veterinarians, we will not allow deletions of pets. Then save the entire modified client list to a file. To give you lots of practice working with arrays DO NOT use the ArrayList class. Use the same file as the input file for the output. This also requires a menu to print, search and add pets once a client is located. The menu should be in a loop. String buffer can be used.
Explanation / Answer
Hi Dear,
Please find my implementation.
Since you have not provided content of clientdata.txt, so i can not test
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.