Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A large veterinarian services many pets and their owners. As new pets are added

ID: 3684731 • Letter: A

Question

A large veterinarian services many pets and their owners. As new pets are added to the population of pets being serviced, their information is entered into a flat text file. Each month, the vet requests a listing of all pets sorted by their outstanding bill balance. You have to write a program to produce a report of animals and their owners sorted by their outstanding balances from the data in the flat text file, as follows.

A class named Animal with the following details/subclasses.

– owner name: a character string – birth year: numeric
– bill balance: numeric
– species: a character string

A subclass of Animal named Mammal with the following details. – number of legs: numeric

A subclass of Animal named nonMammal with the following details. – blood type: a character string

Constructor method(s) of all classes.

Accessor and mutator (get and set) methods of all classes.

Override the toString() and compareTo() methods of all classes. The compareTo() must compare according to bill balance.

Explanation / Answer

class Animal {

String oName;

int byear;

float bBalance;

String species;

   this.oName = oName;

    this.bYear = bYear;

    this.bBalance =bBalance;

   

}

class Mammal extends Animal

{

int noofLegs;

}

class nonMammal extends Animal

{

string bType;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote