Question: Write a program that will create an array of Pet objects from a file of veterinary records. Once the array is fully loaded, sort

Write a program that will create an array of Pet objects froma file of veterinary records. Once the array is fully loaded, sort

Write a program that will create an array of Pet objects from a file of veterinary records. Once the array is fully loaded, sort the array by pet age in ASCENDING order, and then find and display only the youngest and oldest pet. Then, re-sort the array again in ASCENDING order by date of last vaccination (year + month + day) and print the message OwnerName + ", your pet named " + PetName + " was last vaccinated on " + year+"/" + month + "/" + day. The file of Pets will contain the following 10 records: PetName Species Age Year Month Day OwnerLastName OwnerFirstName OwnerEmail Rover canine 5 2021 01 17 Charters Maria Spot canine 3 2021 03 10 Rodriguez Raul Misty feline 8 2020 02 14 Garcia Manuel Rambo canine 2 2020 04 25 Rodriguez Jorge Oreo feline 9 2019 06 5 Morris Garfield Shiloh canine Cozy feline Lady canine Misty feline Pitipua feline 10 2021 07 3 Smith Gonzalez 6 2018 12 17 4 2021 01 8 Joseph 1 2020 10 3 7 2017 09 15 John Jorge Michelle Hernandez Yvette Green Morris This is a sample of what the output will look like: The youngest pet is: Misty. A feline owned by Hernandez, Yvette The oldest pet is: Shiloh. A canine owned by Smith, John mcharter@fiu.edu rrodrig@fiu.edu mgarcia@fiu.edu Morris Green, your pet named Pitipua was last vaccinated 2017/9/15 Jorge Gonzalez, your pet named Cozy was last vaccinated 2018/12/17 Garfield Morris, your pet named Oreo was last vaccinated 2019/6/5 Manuel Garcia, your pet named Misty was last vaccinated 2020/2/14 Jorge Rodriguez, your pet named Rambo was last vaccinated 2020/4/25 Yvette Hernandez, your pet named Misty was last vaccinated 2020/10/3 Michelle Joseph, your pet named Lady was last vaccinated 2021/1/8 Maria Charters, your pet named Rover was last vaccinated 2021/1/17 Raul Rodriguez, your pet named Spot was last vaccinated 2021/3/10 John Smith, your pet named Shiloh was last vaccinated 2021/7/3 BUILD SUCCESSFUL (total time: 0 seconds) jorgeRodriguez@fiu.edu gmorris@fiu.edu jsmith@fiu.edu jgonza17@fiu.edu mjoseph@fiu.edu yhernandez@fiu.edu mgreen@fiu.edu Creation of input text file called pets.txt Definition of Pet Class With the following attributes: PetName Species Age Year Month Day OwnerLastName OwnerFirstName OwnerEmail Driver Class main to call: 1.) method to read file and create array of Pet objects 2.) method to sort array by age of Pet 3.) method to print the array - only oldest & youngest pets 4.) method to re-sort array by date of last vaccination, in ascending order. 5.) method to print all pet objects by date of last vaccination. method #1 - read file & create objects to put in an array of Pets The array should be a length of 10. The method should RETURN the array that was delivered. method #2 - sort the Pet array by age. Then, only print the oldest and youngest pet in the array. Pass the array as a parameter to method. method #3 - print the array's oldest and youngest pets Pass the array as a parameter. method #4 - re-sort array by date of last vaccination! Pass the array to the method. method #5 -print array by date of last vaccination. Pass the array to the method.

Step by Step Solution

3.39 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To accomplish this task in Java you can create a Pet class read the data from the file create an array of Pet objects sort them based on different cri... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!