Write a program that will create an array of Pet objects from a file of veterinary...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. 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.
Expert Answer:
Answer rating: 100% (QA)
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 the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
1- What is the focal length of a converging mirror whose radius of curvature is 20 cm? What is the nature and placement of an image formed by the mirror if an object is 15 cm from the vertex of the...
-
(a) For a fiber-reinforced composite, the efficiency of reinforcement ? is dependent on fiber length l according to where x represents the length of the fiber at each end that does not contribute to...
-
Would it be possible for a firm to have a negative cash cycle? How?
-
A pistoncylinder assembly contains steam initially at 0.965 MPa and 315.6 C. The steam then expands in an isentropic process (i.e., at constant entropy s) to a final pressure of 0.138 MPa. Determine...
-
Mind & Motion entered into a real estate purchase contract (REPC) with Celtic Bank to buy a large piece of the banks foreclosed property. Although the county had approved plans to construct...
-
The Molokai Nut Company (MNC) makes four different products from macadamia nuts grown in the Hawaiian Islands: chocolate-coated whole nuts (Whole), chocolate-coated nut clusters (Cluster),...
-
What is Martin Gardner's argument for the objectivist view of art? Do you agree? Why or why not? Use Vaughns textbook to help you explain Gardners theory and its strengths and weaknesses. Choose an...
-
Saint Leo is developing a plan to promote their new Center in your hometown. The University's marketing director wants to use a varied and balanced approach to IMC. For each of the five IMC types...
-
Use the classical model and the quantity theory of money to predict how each of the following shocks would affect real aggregate income (Y), the real interest rate (r), and the price of goods and...
-
In 2022, Tom Copland moved from Newfoundland to Toronto, Ontario to assume the position of manager for his company at the XYZ's head office, beginning October 1 st . Tom received a salary of $3,900...
-
Our table - top Van deGraaff generator's ( spherical ) dome diameter is 2 5 0 mm; the mini - pie tin mass is 0 . 4 3 4 gram [ not kg ! ] , and a 0 . 0 0 2 7 3 m 2 Area. { a ) What electric Force...
-
What is the taxable amount of the life insurance proceeds that should be included in AGI?
-
As a student in a genetics laboratory, you discover a rare mutation in humans that results inthe total loss of ionotropic receptors in the human tongue. Based on your knowledge oftastant signal...
-
Suppose a compound could point in any of three directions in the solid and still have the same energy. What would be the total entropy (J/K) of orientation if 2.0968e+10 molecules are randomly...
-
Review the following documents: William Rogers Interview David Hume Criminal History Hume Trucking & Hauling Corporate Commission Write a brief memo to the case, that answers the following questions:...
-
You are standing at x = 9.0 km and your assistant is standing at x = 3.0 km. Lightning bolt 1 strikes at x = 0 km and lightning bolt 2 strikes at x = 12.0 km. You see the flash from bolt 2 at t = 10...
-
Create additional select queries for Coast Jewelers using specific criteria (use the Ch l 1-02 file) a. Create and print a select query for Coast Jewelers that lists the buyer name, buyer phone...
-
Add, change, and delete records to the Coast Jewelers database (use the Chi0-02 file) a. Add the following record to the Buyers table: ID 4, Farley, 555-7187. b. Add Bracelets as a category to the...
-
Recall from Chapter 2 that Kelly's Boutique sells books as well as women's shoes. Kelly's son Casey, a college accounting student who is home for the holidays, is eager to help his mom incorporate...
-
For the following op-amp circuit derive the algebraic expression for the output voltage \(v_{o}\) in terms of the two input voltages \(v_{1}(t)\) and \(v_{2}(t)\). Indicate what mathematical...
-
(a) For the following op-amp circuit derive the input-output differential equation relating the output voltage \(v_{o}\) and the input voltage \(v_{i}(t)\). (b) Derive the circuit's State-Variable...
-
Consider the following op-amp circuit where the output is voltage \(v_{o}(t)\) and the input is voltage \(v_{i}(t)\). (a) Choose a set of state variables and justify your choice. (b) Obtain the...
Study smarter with the SolutionInn App