A MyPetStore sells many pets and their accessories. As new pets are added to the MyPetStore, their information is entered into a flat text file. Each month, the manager requests a listing of all pets sorted by their price. You must write a program to produce a report of MyPetStore and their types sorted by their prices from the data in the flat text file. Below is a description of the information on the text file: • The first entry is the number of animals on the file (numeric) • The fields below repeat for each animal: o Pet name (String) o Birthdate (java.time.LocalDate) o Price (numeric) o Species Type (String) o Special feature (boolean or String) The animals sold by the MyPetStore are of six types: Dogs & Cats, Reptiles, Birds, Rabbits & Small Animals. For Dogs & Cats, the special feature field on the flat file is the breed of the animal (String). For Reptiles, the special feature field is the blood type (warm vs cold-blooded, String). For Birds, the special feature field is the movement type (flies or walks, String) For Rabbits & Small Animals, the special feature field is itBites: yes or no (boolean). Program requirements and grading: From the information provided, write a solution that includes the following: § A suitable inheritance hierarchy that represents the pets sold by the MyPetStore. It is up to you how to design the inheritance hierarchy. We suggest a Pet class and appropriate subclasses. § For all classes include the following: o Instance variables  o Constructors  o Accessor and mutator methods o Suitable toString() methods  § Write a class xxxx_program which utilizes the following: o An Array of Pet objects  o A method which reads the input file provided and stores the objects in the array of Pets.  o A method which sorts the array of Pets in ascending order by the price. o A method that formats and prints the output report on the Java console. There should be report headers, one Pet per line and at most 40 Pets per page,  o the main method will call all the other methods which will:  v Read the text file and store the objects in the array. v Sort the objects. v Format and print the report. § Test the program so that there are no errors using the input file provided, input.csv.  structure of the code below follow the stutcture code and example output in link import java.io.File; import java.io.IOException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.InputMismatchException; import java.util.Scanner; // Required Classes: class Pet { } class DogOrCat extends Pet { } class Reptile extends Pet { } class Bird extends Pet { } class RabbitOrSmallAnimal extends Pet { } // public class xxxx_program, you main method is in here public class xxxx_program {             static Pet [] petArr = new Pet[140];       public static void main(String[] args) throws Exception {             arrayPets();             sort(petArr);             printArray(petArr);       }             //Creates an array of pets from the file       public static void arrayPets() throws IOException, InputMismatchException {                    }             //Sorts the array       public static void sort(Pet[] petArr) {             }             //Prints the array       public static void printArray(Pet[] petArr) {                   } }     file:///C:/Users/Erick/Downloads/Example%20Output.pdf

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter8: Arrays
Section: Chapter Questions
Problem 9E
icon
Related questions
Question
A MyPetStore sells many pets and their accessories. As new pets are added to the MyPetStore, their
information is entered into a flat text file. Each month, the manager requests a listing of all pets sorted by
their price. You must write a program to produce a report of MyPetStore and their types sorted by their prices
from the data in the flat text file. Below is a description of the information on the text file:
• The first entry is the number of animals on the file (numeric) •
The fields below repeat for each animal:
o Pet name (String)
o Birthdate (java.time.LocalDate)
o Price (numeric)
o Species Type (String)
o Special feature (boolean or String)
The animals sold by the MyPetStore are of six types: Dogs & Cats, Reptiles, Birds, Rabbits & Small
Animals.
For Dogs & Cats, the special feature field on the flat file is the breed of the animal (String).
For Reptiles, the special feature field is the blood type (warm vs cold-blooded, String).
For Birds, the special feature field is the movement type (flies or walks, String)
For Rabbits & Small Animals, the special feature field is itBites: yes or no (boolean).
Program requirements and grading:
From the information provided, write a solution that includes the following:
§ A suitable inheritance hierarchy that represents the pets sold by the MyPetStore. It is up to
you how to design the inheritance hierarchy. We suggest a Pet class and appropriate
subclasses.
§ For all classes include the following:
o Instance variables 
o Constructors 
o Accessor and mutator methods
o Suitable toString() methods 
§ Write a class xxxx_program which utilizes the following:
o An Array of Pet objects 
o A method which reads the input file provided and stores the objects in the array of Pets. 
o A method which sorts the array of Pets in ascending order by the price.
o A method that formats and prints the output report on the Java console. There should be
report headers, one Pet per line and at most 40 Pets per page, 
o the main method will call all the other methods which will: 
v Read the text file and store the objects in the array.
v Sort the objects.
v Format and print the report.
§ Test the program so that there are no errors using the input file provided, input.csv. 

structure of the code below follow the stutcture code and example output in link

import java.io.File;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.InputMismatchException;
import java.util.Scanner;

// Required Classes:

class Pet {
}


class DogOrCat extends Pet {
}

class Reptile extends Pet {

}
class Bird extends Pet {

}


class RabbitOrSmallAnimal extends Pet {

}


// public class xxxx_program, you main method is in here
public class xxxx_program {
     
      static Pet [] petArr = new Pet[140];
      public static void main(String[] args) throws Exception {
            arrayPets();
            sort(petArr);
            printArray(petArr);
      }
     
      //Creates an array of pets from the file
      public static void arrayPets() throws IOException, InputMismatchException {
           
       }
     
      //Sorts the array
      public static void sort(Pet[] petArr) {
     
      }
     
      //Prints the array
      public static void printArray(Pet[] petArr) {
           
      }

}
 

 
file:///C:/Users/Erick/Downloads/Example%20Output.pdf

 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 7 steps with 3 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage