SlideShare a Scribd company logo
1 of 8
Download to read offline
The purpose of this project is to give students more exposure to object oriented design and
programming using classes and polymorphism in a realistic application that involves arrays of
objects and sorting arrays containing objects. 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 and updates listing of all pets sorted by
their "outstanding bill balance". You are to write a program which will produce a report of
animals and their owners sorted by their outstanding balances from the data in the flat text file.
Program requirements and grading: A class named Animal with the following details and two
subclasses Mammal and nonMammal Name (owner) a character string birth year numeric bill
balance numeric species a character string Special specie feature: Mammal has legs or
nonMammal has blood type (an animal cannot have both features) Constructor, Accessor and
mutator method(s) of all classes An array of Animal objects Read an input text file from with
the ordering as above, one grouping for each animal will be provided. Also, the first item in the
file is the number of animals. You should have I/O exception handling and display a message
"File cannot be found!" if the URL is incorrect. One method for inputting each Animal object.
One method for producing an output report - formatting is one Animal per line and at most 40
Animals per page. One method for sorting the array of Animals. One "simple main" method
that: 1) calls for all input. 2) calls a sort method, and 3) calls for the report of the sorted list.
Record your planning time, coding time, testing time and bug fixing time. Put these information
in the comments at the top of the program. Please have short description in the comments before
each method. Design thoughts: The use of methods and subclasses is very beneficial as
programs become larger and their logic becomes more difficult. In fact, different
industries/companies have their own software development requirements (standards) to improve
readability, testability, maintainability and overall design. It is up to you to logically dissect the
problem and determine the subclasses and methods you will be using in your design. I suggest
that you use the Animal class as a super class and create new subclasses.
Solution
solution)
package com.anm.classes;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Test {
List mammals = new ArrayList();
List non_mammals = new ArrayList();
public void sort() {
Collections.sort(mammals);
Collections.sort(non_mammals);
}
public void output() {
System.out.println("the sorted birthbalance mammals are");
for (Animal a : mammals) {
System.out.println(a.toString());
}
System.out.println("the sorted birth balance non-mammals are");
for (Animal a : non_mammals) {
System.out.println(a.toString());
}
}
public static void main(String[] args) {
Test t = new Test();
String line = null;
try {
URL url = new URL("http://imc.kean.edu/CPS2231/program5.txt");
try {
BufferedReader reader = new BufferedReader(
new InputStreamReader(url.openStream()));
int count1 = 0;
while ((line = reader.readLine()) != null) {
String name = null;
int year = 0;
int birthBalance = 0;
String SpeciesName = null;
int type = 0;
String type1 = null;
String words[] = null;
count1++;
if (count1 == 1) {
System.out.println("the no of animals are :" + line);
} else {
// System.out.println(line);
words = line.split("s+");
name = words[0];
year = Integer.parseInt(words[1]);
birthBalance = Integer.parseInt(words[2]);
SpeciesName = words[3];
try {
type = Integer.parseInt(words[4]);
Animal a = new Mammal(name, year, birthBalance,
SpeciesName, type);
t.mammals.add(a);
// System.out.println(t.mammals.toString());
} catch (NumberFormatException e) {
type1 = words[4];
Animal a = new Non_Mammal(name, year, birthBalance,
SpeciesName, type1);
t.non_mammals.add(a);
// System.out.println(t.non_mammals.toString());
}
}
}
} catch (IOException e) {
System.out.println("unable to read the file");
}
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
System.out.println("file not found");
}
t.sort();
t.output();
}
}
output
the no of animals are :73
the sorted birthbalance mammals are
Mammal [mammal legs are :4 , name=kitty , year=2009 , birthBalance=44 ,
SpeciesName=Cat]
Mammal [mammal legs are :2 , name=Ray , year=2013 , birthBalance=50 ,
SpeciesName=Chicken]
Mammal [mammal legs are :4 , name=kitty2 , year=2009 , birthBalance=64 ,
SpeciesName=Cat]
Mammal [mammal legs are :4 , name=kitty3 , year=2009 , birthBalance=64 ,
SpeciesName=Cat]
Mammal [mammal legs are :4 , name=Johnny , year=2008 , birthBalance=111 ,
SpeciesName=Cat]
Mammal [mammal legs are :4 , name=Johnny2 , year=2008 , birthBalance=111 ,
SpeciesName=Cat]
Mammal [mammal legs are :4 , name=Johnny3 , year=2008 , birthBalance=111 ,
SpeciesName=Cat]
Mammal [mammal legs are :4 , name=William , year=2009 , birthBalance=113 ,
SpeciesName=Cat]
Mammal [mammal legs are :2 , name=Grant , year=2013 , birthBalance=150 ,
SpeciesName=Duck]
Mammal [mammal legs are :4 , name=William2 , year=2009 , birthBalance=213 ,
SpeciesName=Cat]
Mammal [mammal legs are :4 , name=William3 , year=2009 , birthBalance=213 ,
SpeciesName=Cat]
Mammal [mammal legs are :2 , name=Ray2 , year=2013 , birthBalance=250 ,
SpeciesName=Chicken]
Mammal [mammal legs are :2 , name=Ray3 , year=2013 , birthBalance=250 ,
SpeciesName=Chicken]
Mammal [mammal legs are :4 , name=John , year=2014 , birthBalance=300 ,
SpeciesName=Cat]
Mammal [mammal legs are :4 , name=John2 , year=2014 , birthBalance=320 ,
SpeciesName=Cat]
Mammal [mammal legs are :4 , name=John3 , year=2014 , birthBalance=320 ,
SpeciesName=Cat]
Mammal [mammal legs are :4 , name=Spot , year=2005 , birthBalance=333 ,
SpeciesName=Dog]
Mammal [mammal legs are :4 , name=Spot2 , year=2005 , birthBalance=333 ,
SpeciesName=Dog]
Mammal [mammal legs are :4 , name=Spot3 , year=2005 , birthBalance=333 ,
SpeciesName=Dog]
Mammal [mammal legs are :2 , name=Grant2 , year=2013 , birthBalance=350 ,
SpeciesName=Duck]
Mammal [mammal legs are :2 , name=Grant3 , year=2013 , birthBalance=350 ,
SpeciesName=Duck]
Mammal [mammal legs are :4 , name=Sam , year=2014 , birthBalance=400 ,
SpeciesName=Tiger]
Mammal [mammal legs are :4 , name=Sam2 , year=2014 , birthBalance=410 ,
SpeciesName=Tiger]
Mammal [mammal legs are :4 , name=Sam3 , year=2014 , birthBalance=410 ,
SpeciesName=Tiger]
Mammal [mammal legs are :4 , name=Striper , year=2011 , birthBalance=432 ,
SpeciesName=Sckunk]
Mammal [mammal legs are :4 , name=Dan , year=2015 , birthBalance=433 ,
SpeciesName=Dog]
Mammal [mammal legs are :4 , name=Dan2 , year=2015 , birthBalance=433 ,
SpeciesName=Dog]
Mammal [mammal legs are :4 , name=Dan3 , year=2015 , birthBalance=433 ,
SpeciesName=Dog]
Mammal [mammal legs are :4 , name=Boots2 , year=2005 , birthBalance=487 ,
SpeciesName=Horse]
Mammal [mammal legs are :4 , name=Boots3 , year=2005 , birthBalance=487 ,
SpeciesName=Horse]
Mammal [mammal legs are :4 , name=Mary , year=2013 , birthBalance=500 ,
SpeciesName=Dog]
Mammal [mammal legs are :4 , name=Mary2 , year=2013 , birthBalance=520 ,
SpeciesName=Dog]
Mammal [mammal legs are :4 , name=Mary3 , year=2013 , birthBalance=520 ,
SpeciesName=Dog]
Mammal [mammal legs are :2 , name=hopper , year=2003 , birthBalance=555 ,
SpeciesName=Kangaroo]
Mammal [mammal legs are :2 , name=Hopper2 , year=2003 , birthBalance=575 ,
SpeciesName=Kangaroo]
Mammal [mammal legs are :2 , name=Hopper3 , year=2003 , birthBalance=575 ,
SpeciesName=Kangaroo]
Mammal [mammal legs are :4 , name=Green2 , year=2011 , birthBalance=600 ,
SpeciesName=Horse]
Mammal [mammal legs are :4 , name=Green3 , year=2011 , birthBalance=600 ,
SpeciesName=Horse]
Mammal [mammal legs are :4 , name=Edward , year=1995 , birthBalance=630 ,
SpeciesName=Horse]
Mammal [mammal legs are :4 , name=Edward2 , year=1995 , birthBalance=630 ,
SpeciesName=Horse]
Mammal [mammal legs are :4 , name=Edward3 , year=1995 , birthBalance=630 ,
SpeciesName=Horse]
Mammal [mammal legs are :4 , name=Striper2 , year=2011 , birthBalance=732 ,
SpeciesName=Sckunk]
Mammal [mammal legs are :4 , name=Striper3 , year=2011 , birthBalance=732 ,
SpeciesName=Sckunk]
Mammal [mammal legs are :4 , name=Green , year=2011 , birthBalance=800 ,
SpeciesName=Horse]
Mammal [mammal legs are :4 , name=Sarah , year=2011 , birthBalance=900 ,
SpeciesName=Horse]
Mammal [mammal legs are :4 , name=Sarah2 , year=2011 , birthBalance=950 ,
SpeciesName=Horse]
Mammal [mammal legs are :4 , name=Sarah3 , year=2011 , birthBalance=950 ,
SpeciesName=Horse]
Mammal [mammal legs are :4 , name=Boots , year=2005 , birthBalance=987 ,
SpeciesName=Horse]
Mammal [mammal legs are :2 , name=Austin , year=2015 , birthBalance=1500 ,
SpeciesName=Monkey]
Mammal [mammal legs are :2 , name=Austin2 , year=2015 , birthBalance=2500 ,
SpeciesName=Monkey]
Mammal [mammal legs are :2 , name=Austin3 , year=2015 , birthBalance=2530 ,
SpeciesName=Monkey]
the sorted birth balance non-mammals are
Non_Mammal [type=Cold-Blooded , name=Duke , year=2014 , birthBalance=10 ,
SpeciesName=fish]
Non_Mammal [type=Cold-Blooded , name=Claudia2 , year=2014 , birthBalance=10 ,
SpeciesName=Squid]
Non_Mammal [type=Cold-Blooded , name=Claudia3 , year=2014 , birthBalance=15 ,
SpeciesName=Squid]
Non_Mammal [type=Warm-Blooded , name=Annie , year=2011 , birthBalance=20 ,
SpeciesName=Bird]
Non_Mammal [type=Cold-Blooded , name=Claudia , year=2014 , birthBalance=20 ,
SpeciesName=Squid]
Non_Mammal [type=Cold-Blooded , name=Ryan , year=2014 , birthBalance=21 ,
SpeciesName=fish]
Non_Mammal [type=Warm-Blooded , name=Ray , year=2011 , birthBalance=30 ,
SpeciesName=Bird]
Non_Mammal [type=Cold-Blooded , name=casper , year=1998 , birthBalance=88 ,
SpeciesName=Snake]
Non_Mammal [type=Cold-Blooded , name=Ryan2 , year=2014 , birthBalance=110 ,
SpeciesName=fish]
Non_Mammal [type=Cold-Blooded , name=Ryan3 , year=2014 , birthBalance=110 ,
SpeciesName=fish]
Non_Mammal [type=Warm-Blooded , name=Annie2 , year=2011 , birthBalance=120 ,
SpeciesName=Bird]
Non_Mammal [type=Warm-Blooded , name=Annie3 , year=2011 , birthBalance=120 ,
SpeciesName=Bird]
Non_Mammal [type=Warm-Blooded , name=Ray2 , year=2011 , birthBalance=130 ,
SpeciesName=Bird]
Non_Mammal [type=Warm-Blooded , name=Ray3 , year=2011 , birthBalance=130 ,
SpeciesName=Bird]
Non_Mammal [type=Cold-Blooded , name=casper2 , year=1998 , birthBalance=188 ,
SpeciesName=Snake]
Non_Mammal [type=Cold-Blooded , name=casper3 , year=1998 , birthBalance=188 ,
SpeciesName=Snake]
Non_Mammal [type=Cold-Blooded , name=Willy , year=2012 , birthBalance=250 ,
SpeciesName=Snake]
Non_Mammal [type=Cold-Blooded , name=Willy , year=2012 , birthBalance=250 ,
SpeciesName=Snake]
Non_Mammal [type=Cold-Blooded , name=Willy2 , year=2012 , birthBalance=250 ,
SpeciesName=Snake]
Non_Mammal [type=Cold-Blooded , name=Willy3 , year=2012 , birthBalance=250 ,
SpeciesName=Snake]
Non_Mammal [type=Cold-Blooded , name=Willy2 , year=2012 , birthBalance=350 ,
SpeciesName=Snake]
Non_Mammal [type=Cold-Blooded , name=Willy3 , year=2012 , birthBalance=350 ,
SpeciesName=Snake]

More Related Content

Similar to The purpose of this project is to give students more exposure to obje.pdf

CS 151 Unit 6 Assignment
CS 151 Unit 6 AssignmentCS 151 Unit 6 Assignment
CS 151 Unit 6 AssignmentAdamLamberts
 
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdf
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdfDOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdf
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdfarchanaemporium
 
Project Bird species The OrdwayBirds data frame is a histor.pdf
Project Bird species The OrdwayBirds data frame is a histor.pdfProject Bird species The OrdwayBirds data frame is a histor.pdf
Project Bird species The OrdwayBirds data frame is a histor.pdfabdulahmad786
 
Specifications pattern - Ted's Tool Time
Specifications pattern - Ted's Tool TimeSpecifications pattern - Ted's Tool Time
Specifications pattern - Ted's Tool TimeTed Vinke
 
package lists; This class represents different animal ch.docx
 package lists;  This class represents different animal ch.docx package lists;  This class represents different animal ch.docx
package lists; This class represents different animal ch.docxaryan532920
 
I need some help creating Psuedocode for a project using Java. Basic.pdf
I need some help creating Psuedocode for a project using Java. Basic.pdfI need some help creating Psuedocode for a project using Java. Basic.pdf
I need some help creating Psuedocode for a project using Java. Basic.pdffashionfootwear1
 
14 Defining classes
14 Defining classes14 Defining classes
14 Defining classesmaznabili
 
Ground Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - ClassesGround Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - ClassesChariza Pladin
 
Marcs (bio)perl course
Marcs (bio)perl courseMarcs (bio)perl course
Marcs (bio)perl courseBITS
 
Basic inheritance in JavaScript
Basic inheritance in JavaScriptBasic inheritance in JavaScript
Basic inheritance in JavaScriptBrian Moschel
 
C++ Programming Polymorphism Assignment InstructionsOverview 
C++ Programming Polymorphism Assignment InstructionsOverview C++ Programming Polymorphism Assignment InstructionsOverview 
C++ Programming Polymorphism Assignment InstructionsOverview TawnaDelatorrejs
 
Machine learning and decision trees
Machine learning and decision treesMachine learning and decision trees
Machine learning and decision treesPadma Metta
 
Supo gr2 science_activities1
Supo gr2 science_activities1Supo gr2 science_activities1
Supo gr2 science_activities1Diego Mora
 
Write a program that asks the user for the name of a file. The progr.pdf
Write a program that asks the user for the name of a file. The progr.pdfWrite a program that asks the user for the name of a file. The progr.pdf
Write a program that asks the user for the name of a file. The progr.pdfarri2009av
 
Machine Learning in a Flash (Extended Edition): An Introduction to Natural La...
Machine Learning in a Flash (Extended Edition): An Introduction to Natural La...Machine Learning in a Flash (Extended Edition): An Introduction to Natural La...
Machine Learning in a Flash (Extended Edition): An Introduction to Natural La...Kory Becker
 
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdf
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdfAdapt your code from Assignment 2 to use both a Java API ArrayList a.pdf
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdfalbarefqc
 
An-Introduction-to-SPSS-Workshop-SessionV2-2.pptx
An-Introduction-to-SPSS-Workshop-SessionV2-2.pptxAn-Introduction-to-SPSS-Workshop-SessionV2-2.pptx
An-Introduction-to-SPSS-Workshop-SessionV2-2.pptxCharlou Bautista
 
Task Implement the 12 classes 5 enums and one interface s.pdf
Task Implement the 12 classes 5 enums and one interface s.pdfTask Implement the 12 classes 5 enums and one interface s.pdf
Task Implement the 12 classes 5 enums and one interface s.pdfacsmadurai
 

Similar to The purpose of this project is to give students more exposure to obje.pdf (20)

CS 151 Unit 6 Assignment
CS 151 Unit 6 AssignmentCS 151 Unit 6 Assignment
CS 151 Unit 6 Assignment
 
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdf
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdfDOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdf
DOES NOT NEED TO BE ANSWERED UNTIL NOV 13thWords AssignmentRober.pdf
 
Project Bird species The OrdwayBirds data frame is a histor.pdf
Project Bird species The OrdwayBirds data frame is a histor.pdfProject Bird species The OrdwayBirds data frame is a histor.pdf
Project Bird species The OrdwayBirds data frame is a histor.pdf
 
Specifications pattern - Ted's Tool Time
Specifications pattern - Ted's Tool TimeSpecifications pattern - Ted's Tool Time
Specifications pattern - Ted's Tool Time
 
package lists; This class represents different animal ch.docx
 package lists;  This class represents different animal ch.docx package lists;  This class represents different animal ch.docx
package lists; This class represents different animal ch.docx
 
I need some help creating Psuedocode for a project using Java. Basic.pdf
I need some help creating Psuedocode for a project using Java. Basic.pdfI need some help creating Psuedocode for a project using Java. Basic.pdf
I need some help creating Psuedocode for a project using Java. Basic.pdf
 
Baabtra.com little coder chapter - 3
Baabtra.com little coder   chapter - 3Baabtra.com little coder   chapter - 3
Baabtra.com little coder chapter - 3
 
14 Defining classes
14 Defining classes14 Defining classes
14 Defining classes
 
Ground Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - ClassesGround Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - Classes
 
Marcs (bio)perl course
Marcs (bio)perl courseMarcs (bio)perl course
Marcs (bio)perl course
 
Basic inheritance in JavaScript
Basic inheritance in JavaScriptBasic inheritance in JavaScript
Basic inheritance in JavaScript
 
atyu.pptx
atyu.pptxatyu.pptx
atyu.pptx
 
C++ Programming Polymorphism Assignment InstructionsOverview 
C++ Programming Polymorphism Assignment InstructionsOverview C++ Programming Polymorphism Assignment InstructionsOverview 
C++ Programming Polymorphism Assignment InstructionsOverview 
 
Machine learning and decision trees
Machine learning and decision treesMachine learning and decision trees
Machine learning and decision trees
 
Supo gr2 science_activities1
Supo gr2 science_activities1Supo gr2 science_activities1
Supo gr2 science_activities1
 
Write a program that asks the user for the name of a file. The progr.pdf
Write a program that asks the user for the name of a file. The progr.pdfWrite a program that asks the user for the name of a file. The progr.pdf
Write a program that asks the user for the name of a file. The progr.pdf
 
Machine Learning in a Flash (Extended Edition): An Introduction to Natural La...
Machine Learning in a Flash (Extended Edition): An Introduction to Natural La...Machine Learning in a Flash (Extended Edition): An Introduction to Natural La...
Machine Learning in a Flash (Extended Edition): An Introduction to Natural La...
 
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdf
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdfAdapt your code from Assignment 2 to use both a Java API ArrayList a.pdf
Adapt your code from Assignment 2 to use both a Java API ArrayList a.pdf
 
An-Introduction-to-SPSS-Workshop-SessionV2-2.pptx
An-Introduction-to-SPSS-Workshop-SessionV2-2.pptxAn-Introduction-to-SPSS-Workshop-SessionV2-2.pptx
An-Introduction-to-SPSS-Workshop-SessionV2-2.pptx
 
Task Implement the 12 classes 5 enums and one interface s.pdf
Task Implement the 12 classes 5 enums and one interface s.pdfTask Implement the 12 classes 5 enums and one interface s.pdf
Task Implement the 12 classes 5 enums and one interface s.pdf
 

More from forwardcom41

Hello!Can someone help me to answer Task4 and Task7Complete T.pdf
Hello!Can someone help me to answer Task4 and Task7Complete T.pdfHello!Can someone help me to answer Task4 and Task7Complete T.pdf
Hello!Can someone help me to answer Task4 and Task7Complete T.pdfforwardcom41
 
Hey I need help creating this code using Visual Studio (Basic) 2015.pdf
Hey I need help creating this code using Visual Studio (Basic) 2015.pdfHey I need help creating this code using Visual Studio (Basic) 2015.pdf
Hey I need help creating this code using Visual Studio (Basic) 2015.pdfforwardcom41
 
Given technology today, would it be more feasible than in the pa.pdf
Given technology today, would it be more feasible than in the pa.pdfGiven technology today, would it be more feasible than in the pa.pdf
Given technology today, would it be more feasible than in the pa.pdfforwardcom41
 
Explain the difference between a contaminated culture and a mix c.pdf
Explain the difference between a contaminated culture and a mix c.pdfExplain the difference between a contaminated culture and a mix c.pdf
Explain the difference between a contaminated culture and a mix c.pdfforwardcom41
 
Explain in detail how OFDM helps mitigates multipath fading effects..pdf
Explain in detail how OFDM helps mitigates multipath fading effects..pdfExplain in detail how OFDM helps mitigates multipath fading effects..pdf
Explain in detail how OFDM helps mitigates multipath fading effects..pdfforwardcom41
 
Complete a scientific inquiry research using three credible sources..pdf
Complete a scientific inquiry research using three credible sources..pdfComplete a scientific inquiry research using three credible sources..pdf
Complete a scientific inquiry research using three credible sources..pdfforwardcom41
 
Combine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdfCombine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdfforwardcom41
 
Describe and illustrate the use of a bank reconciliation in controll.pdf
Describe and illustrate the use of a bank reconciliation in controll.pdfDescribe and illustrate the use of a bank reconciliation in controll.pdf
Describe and illustrate the use of a bank reconciliation in controll.pdfforwardcom41
 
Why is it important for a trainer (trainers) to understand the commu.pdf
Why is it important for a trainer (trainers) to understand the commu.pdfWhy is it important for a trainer (trainers) to understand the commu.pdf
Why is it important for a trainer (trainers) to understand the commu.pdfforwardcom41
 
What are the various portals an enterprise can use What is the func.pdf
What are the various portals an enterprise can use What is the func.pdfWhat are the various portals an enterprise can use What is the func.pdf
What are the various portals an enterprise can use What is the func.pdfforwardcom41
 
What is the nature of thermal energy What is heat at the atomic lev.pdf
What is the nature of thermal energy What is heat at the atomic lev.pdfWhat is the nature of thermal energy What is heat at the atomic lev.pdf
What is the nature of thermal energy What is heat at the atomic lev.pdfforwardcom41
 
w Hstory Bookmarks Window Help Apple Bing Google Taho0 NewaDetals MIN.pdf
w Hstory Bookmarks Window Help Apple Bing Google Taho0 NewaDetals MIN.pdfw Hstory Bookmarks Window Help Apple Bing Google Taho0 NewaDetals MIN.pdf
w Hstory Bookmarks Window Help Apple Bing Google Taho0 NewaDetals MIN.pdfforwardcom41
 
Which of the following is not one of the ethical standards included .pdf
Which of the following is not one of the ethical standards included .pdfWhich of the following is not one of the ethical standards included .pdf
Which of the following is not one of the ethical standards included .pdfforwardcom41
 
Using the guidance from ASC 855-10-55-1 and 855-10-55-2 Answer the f.pdf
Using the guidance from ASC 855-10-55-1 and 855-10-55-2 Answer the f.pdfUsing the guidance from ASC 855-10-55-1 and 855-10-55-2 Answer the f.pdf
Using the guidance from ASC 855-10-55-1 and 855-10-55-2 Answer the f.pdfforwardcom41
 
why we need mixed methodology for researchSolutionMixed metho.pdf
why we need mixed methodology for researchSolutionMixed metho.pdfwhy we need mixed methodology for researchSolutionMixed metho.pdf
why we need mixed methodology for researchSolutionMixed metho.pdfforwardcom41
 
What property doesnt apply to fluids Newtons second, cons of ene.pdf
What property doesnt apply to fluids Newtons second, cons of ene.pdfWhat property doesnt apply to fluids Newtons second, cons of ene.pdf
What property doesnt apply to fluids Newtons second, cons of ene.pdfforwardcom41
 
What is the threat to culture by a read-only world, and how do t.pdf
What is the threat to culture by a read-only world, and how do t.pdfWhat is the threat to culture by a read-only world, and how do t.pdf
What is the threat to culture by a read-only world, and how do t.pdfforwardcom41
 
What is one hypothesis to explain why there are more endemic bird sp.pdf
What is one hypothesis to explain why there are more endemic bird sp.pdfWhat is one hypothesis to explain why there are more endemic bird sp.pdf
What is one hypothesis to explain why there are more endemic bird sp.pdfforwardcom41
 
What are the ethical tensions in advertisingWho are the responsib.pdf
What are the ethical tensions in advertisingWho are the responsib.pdfWhat are the ethical tensions in advertisingWho are the responsib.pdf
What are the ethical tensions in advertisingWho are the responsib.pdfforwardcom41
 
Use the following information to answer the next Question. The graph.pdf
Use the following information to answer the next Question.  The graph.pdfUse the following information to answer the next Question.  The graph.pdf
Use the following information to answer the next Question. The graph.pdfforwardcom41
 

More from forwardcom41 (20)

Hello!Can someone help me to answer Task4 and Task7Complete T.pdf
Hello!Can someone help me to answer Task4 and Task7Complete T.pdfHello!Can someone help me to answer Task4 and Task7Complete T.pdf
Hello!Can someone help me to answer Task4 and Task7Complete T.pdf
 
Hey I need help creating this code using Visual Studio (Basic) 2015.pdf
Hey I need help creating this code using Visual Studio (Basic) 2015.pdfHey I need help creating this code using Visual Studio (Basic) 2015.pdf
Hey I need help creating this code using Visual Studio (Basic) 2015.pdf
 
Given technology today, would it be more feasible than in the pa.pdf
Given technology today, would it be more feasible than in the pa.pdfGiven technology today, would it be more feasible than in the pa.pdf
Given technology today, would it be more feasible than in the pa.pdf
 
Explain the difference between a contaminated culture and a mix c.pdf
Explain the difference between a contaminated culture and a mix c.pdfExplain the difference between a contaminated culture and a mix c.pdf
Explain the difference between a contaminated culture and a mix c.pdf
 
Explain in detail how OFDM helps mitigates multipath fading effects..pdf
Explain in detail how OFDM helps mitigates multipath fading effects..pdfExplain in detail how OFDM helps mitigates multipath fading effects..pdf
Explain in detail how OFDM helps mitigates multipath fading effects..pdf
 
Complete a scientific inquiry research using three credible sources..pdf
Complete a scientific inquiry research using three credible sources..pdfComplete a scientific inquiry research using three credible sources..pdf
Complete a scientific inquiry research using three credible sources..pdf
 
Combine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdfCombine the keypad and LCD codes in compliance to the following requ.pdf
Combine the keypad and LCD codes in compliance to the following requ.pdf
 
Describe and illustrate the use of a bank reconciliation in controll.pdf
Describe and illustrate the use of a bank reconciliation in controll.pdfDescribe and illustrate the use of a bank reconciliation in controll.pdf
Describe and illustrate the use of a bank reconciliation in controll.pdf
 
Why is it important for a trainer (trainers) to understand the commu.pdf
Why is it important for a trainer (trainers) to understand the commu.pdfWhy is it important for a trainer (trainers) to understand the commu.pdf
Why is it important for a trainer (trainers) to understand the commu.pdf
 
What are the various portals an enterprise can use What is the func.pdf
What are the various portals an enterprise can use What is the func.pdfWhat are the various portals an enterprise can use What is the func.pdf
What are the various portals an enterprise can use What is the func.pdf
 
What is the nature of thermal energy What is heat at the atomic lev.pdf
What is the nature of thermal energy What is heat at the atomic lev.pdfWhat is the nature of thermal energy What is heat at the atomic lev.pdf
What is the nature of thermal energy What is heat at the atomic lev.pdf
 
w Hstory Bookmarks Window Help Apple Bing Google Taho0 NewaDetals MIN.pdf
w Hstory Bookmarks Window Help Apple Bing Google Taho0 NewaDetals MIN.pdfw Hstory Bookmarks Window Help Apple Bing Google Taho0 NewaDetals MIN.pdf
w Hstory Bookmarks Window Help Apple Bing Google Taho0 NewaDetals MIN.pdf
 
Which of the following is not one of the ethical standards included .pdf
Which of the following is not one of the ethical standards included .pdfWhich of the following is not one of the ethical standards included .pdf
Which of the following is not one of the ethical standards included .pdf
 
Using the guidance from ASC 855-10-55-1 and 855-10-55-2 Answer the f.pdf
Using the guidance from ASC 855-10-55-1 and 855-10-55-2 Answer the f.pdfUsing the guidance from ASC 855-10-55-1 and 855-10-55-2 Answer the f.pdf
Using the guidance from ASC 855-10-55-1 and 855-10-55-2 Answer the f.pdf
 
why we need mixed methodology for researchSolutionMixed metho.pdf
why we need mixed methodology for researchSolutionMixed metho.pdfwhy we need mixed methodology for researchSolutionMixed metho.pdf
why we need mixed methodology for researchSolutionMixed metho.pdf
 
What property doesnt apply to fluids Newtons second, cons of ene.pdf
What property doesnt apply to fluids Newtons second, cons of ene.pdfWhat property doesnt apply to fluids Newtons second, cons of ene.pdf
What property doesnt apply to fluids Newtons second, cons of ene.pdf
 
What is the threat to culture by a read-only world, and how do t.pdf
What is the threat to culture by a read-only world, and how do t.pdfWhat is the threat to culture by a read-only world, and how do t.pdf
What is the threat to culture by a read-only world, and how do t.pdf
 
What is one hypothesis to explain why there are more endemic bird sp.pdf
What is one hypothesis to explain why there are more endemic bird sp.pdfWhat is one hypothesis to explain why there are more endemic bird sp.pdf
What is one hypothesis to explain why there are more endemic bird sp.pdf
 
What are the ethical tensions in advertisingWho are the responsib.pdf
What are the ethical tensions in advertisingWho are the responsib.pdfWhat are the ethical tensions in advertisingWho are the responsib.pdf
What are the ethical tensions in advertisingWho are the responsib.pdf
 
Use the following information to answer the next Question. The graph.pdf
Use the following information to answer the next Question.  The graph.pdfUse the following information to answer the next Question.  The graph.pdf
Use the following information to answer the next Question. The graph.pdf
 

Recently uploaded

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIShubhangi Sonawane
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 

Recently uploaded (20)

Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 

The purpose of this project is to give students more exposure to obje.pdf

  • 1. The purpose of this project is to give students more exposure to object oriented design and programming using classes and polymorphism in a realistic application that involves arrays of objects and sorting arrays containing objects. 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 and updates listing of all pets sorted by their "outstanding bill balance". You are to write a program which will produce a report of animals and their owners sorted by their outstanding balances from the data in the flat text file. Program requirements and grading: A class named Animal with the following details and two subclasses Mammal and nonMammal Name (owner) a character string birth year numeric bill balance numeric species a character string Special specie feature: Mammal has legs or nonMammal has blood type (an animal cannot have both features) Constructor, Accessor and mutator method(s) of all classes An array of Animal objects Read an input text file from with the ordering as above, one grouping for each animal will be provided. Also, the first item in the file is the number of animals. You should have I/O exception handling and display a message "File cannot be found!" if the URL is incorrect. One method for inputting each Animal object. One method for producing an output report - formatting is one Animal per line and at most 40 Animals per page. One method for sorting the array of Animals. One "simple main" method that: 1) calls for all input. 2) calls a sort method, and 3) calls for the report of the sorted list. Record your planning time, coding time, testing time and bug fixing time. Put these information in the comments at the top of the program. Please have short description in the comments before each method. Design thoughts: The use of methods and subclasses is very beneficial as programs become larger and their logic becomes more difficult. In fact, different industries/companies have their own software development requirements (standards) to improve readability, testability, maintainability and overall design. It is up to you to logically dissect the problem and determine the subclasses and methods you will be using in your design. I suggest that you use the Animal class as a super class and create new subclasses. Solution solution) package com.anm.classes; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import java.net.URL;
  • 2. import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Test { List mammals = new ArrayList(); List non_mammals = new ArrayList(); public void sort() { Collections.sort(mammals); Collections.sort(non_mammals); } public void output() { System.out.println("the sorted birthbalance mammals are"); for (Animal a : mammals) { System.out.println(a.toString()); } System.out.println("the sorted birth balance non-mammals are"); for (Animal a : non_mammals) { System.out.println(a.toString()); } } public static void main(String[] args) { Test t = new Test(); String line = null; try { URL url = new URL("http://imc.kean.edu/CPS2231/program5.txt"); try { BufferedReader reader = new BufferedReader( new InputStreamReader(url.openStream())); int count1 = 0; while ((line = reader.readLine()) != null) { String name = null; int year = 0; int birthBalance = 0; String SpeciesName = null; int type = 0; String type1 = null;
  • 3. String words[] = null; count1++; if (count1 == 1) { System.out.println("the no of animals are :" + line); } else { // System.out.println(line); words = line.split("s+"); name = words[0]; year = Integer.parseInt(words[1]); birthBalance = Integer.parseInt(words[2]); SpeciesName = words[3]; try { type = Integer.parseInt(words[4]); Animal a = new Mammal(name, year, birthBalance, SpeciesName, type); t.mammals.add(a); // System.out.println(t.mammals.toString()); } catch (NumberFormatException e) { type1 = words[4]; Animal a = new Non_Mammal(name, year, birthBalance, SpeciesName, type1); t.non_mammals.add(a); // System.out.println(t.non_mammals.toString()); } } } } catch (IOException e) { System.out.println("unable to read the file"); } } catch (MalformedURLException e) { // TODO Auto-generated catch block System.out.println("file not found"); } t.sort(); t.output(); }
  • 4. } output the no of animals are :73 the sorted birthbalance mammals are Mammal [mammal legs are :4 , name=kitty , year=2009 , birthBalance=44 , SpeciesName=Cat] Mammal [mammal legs are :2 , name=Ray , year=2013 , birthBalance=50 , SpeciesName=Chicken] Mammal [mammal legs are :4 , name=kitty2 , year=2009 , birthBalance=64 , SpeciesName=Cat] Mammal [mammal legs are :4 , name=kitty3 , year=2009 , birthBalance=64 , SpeciesName=Cat] Mammal [mammal legs are :4 , name=Johnny , year=2008 , birthBalance=111 , SpeciesName=Cat] Mammal [mammal legs are :4 , name=Johnny2 , year=2008 , birthBalance=111 , SpeciesName=Cat] Mammal [mammal legs are :4 , name=Johnny3 , year=2008 , birthBalance=111 , SpeciesName=Cat] Mammal [mammal legs are :4 , name=William , year=2009 , birthBalance=113 , SpeciesName=Cat] Mammal [mammal legs are :2 , name=Grant , year=2013 , birthBalance=150 , SpeciesName=Duck] Mammal [mammal legs are :4 , name=William2 , year=2009 , birthBalance=213 , SpeciesName=Cat] Mammal [mammal legs are :4 , name=William3 , year=2009 , birthBalance=213 , SpeciesName=Cat] Mammal [mammal legs are :2 , name=Ray2 , year=2013 , birthBalance=250 , SpeciesName=Chicken] Mammal [mammal legs are :2 , name=Ray3 , year=2013 , birthBalance=250 , SpeciesName=Chicken] Mammal [mammal legs are :4 , name=John , year=2014 , birthBalance=300 , SpeciesName=Cat] Mammal [mammal legs are :4 , name=John2 , year=2014 , birthBalance=320 , SpeciesName=Cat] Mammal [mammal legs are :4 , name=John3 , year=2014 , birthBalance=320 , SpeciesName=Cat]
  • 5. Mammal [mammal legs are :4 , name=Spot , year=2005 , birthBalance=333 , SpeciesName=Dog] Mammal [mammal legs are :4 , name=Spot2 , year=2005 , birthBalance=333 , SpeciesName=Dog] Mammal [mammal legs are :4 , name=Spot3 , year=2005 , birthBalance=333 , SpeciesName=Dog] Mammal [mammal legs are :2 , name=Grant2 , year=2013 , birthBalance=350 , SpeciesName=Duck] Mammal [mammal legs are :2 , name=Grant3 , year=2013 , birthBalance=350 , SpeciesName=Duck] Mammal [mammal legs are :4 , name=Sam , year=2014 , birthBalance=400 , SpeciesName=Tiger] Mammal [mammal legs are :4 , name=Sam2 , year=2014 , birthBalance=410 , SpeciesName=Tiger] Mammal [mammal legs are :4 , name=Sam3 , year=2014 , birthBalance=410 , SpeciesName=Tiger] Mammal [mammal legs are :4 , name=Striper , year=2011 , birthBalance=432 , SpeciesName=Sckunk] Mammal [mammal legs are :4 , name=Dan , year=2015 , birthBalance=433 , SpeciesName=Dog] Mammal [mammal legs are :4 , name=Dan2 , year=2015 , birthBalance=433 , SpeciesName=Dog] Mammal [mammal legs are :4 , name=Dan3 , year=2015 , birthBalance=433 , SpeciesName=Dog] Mammal [mammal legs are :4 , name=Boots2 , year=2005 , birthBalance=487 , SpeciesName=Horse] Mammal [mammal legs are :4 , name=Boots3 , year=2005 , birthBalance=487 , SpeciesName=Horse] Mammal [mammal legs are :4 , name=Mary , year=2013 , birthBalance=500 , SpeciesName=Dog] Mammal [mammal legs are :4 , name=Mary2 , year=2013 , birthBalance=520 , SpeciesName=Dog] Mammal [mammal legs are :4 , name=Mary3 , year=2013 , birthBalance=520 , SpeciesName=Dog] Mammal [mammal legs are :2 , name=hopper , year=2003 , birthBalance=555 , SpeciesName=Kangaroo]
  • 6. Mammal [mammal legs are :2 , name=Hopper2 , year=2003 , birthBalance=575 , SpeciesName=Kangaroo] Mammal [mammal legs are :2 , name=Hopper3 , year=2003 , birthBalance=575 , SpeciesName=Kangaroo] Mammal [mammal legs are :4 , name=Green2 , year=2011 , birthBalance=600 , SpeciesName=Horse] Mammal [mammal legs are :4 , name=Green3 , year=2011 , birthBalance=600 , SpeciesName=Horse] Mammal [mammal legs are :4 , name=Edward , year=1995 , birthBalance=630 , SpeciesName=Horse] Mammal [mammal legs are :4 , name=Edward2 , year=1995 , birthBalance=630 , SpeciesName=Horse] Mammal [mammal legs are :4 , name=Edward3 , year=1995 , birthBalance=630 , SpeciesName=Horse] Mammal [mammal legs are :4 , name=Striper2 , year=2011 , birthBalance=732 , SpeciesName=Sckunk] Mammal [mammal legs are :4 , name=Striper3 , year=2011 , birthBalance=732 , SpeciesName=Sckunk] Mammal [mammal legs are :4 , name=Green , year=2011 , birthBalance=800 , SpeciesName=Horse] Mammal [mammal legs are :4 , name=Sarah , year=2011 , birthBalance=900 , SpeciesName=Horse] Mammal [mammal legs are :4 , name=Sarah2 , year=2011 , birthBalance=950 , SpeciesName=Horse] Mammal [mammal legs are :4 , name=Sarah3 , year=2011 , birthBalance=950 , SpeciesName=Horse] Mammal [mammal legs are :4 , name=Boots , year=2005 , birthBalance=987 , SpeciesName=Horse] Mammal [mammal legs are :2 , name=Austin , year=2015 , birthBalance=1500 , SpeciesName=Monkey] Mammal [mammal legs are :2 , name=Austin2 , year=2015 , birthBalance=2500 , SpeciesName=Monkey] Mammal [mammal legs are :2 , name=Austin3 , year=2015 , birthBalance=2530 , SpeciesName=Monkey] the sorted birth balance non-mammals are Non_Mammal [type=Cold-Blooded , name=Duke , year=2014 , birthBalance=10 ,
  • 7. SpeciesName=fish] Non_Mammal [type=Cold-Blooded , name=Claudia2 , year=2014 , birthBalance=10 , SpeciesName=Squid] Non_Mammal [type=Cold-Blooded , name=Claudia3 , year=2014 , birthBalance=15 , SpeciesName=Squid] Non_Mammal [type=Warm-Blooded , name=Annie , year=2011 , birthBalance=20 , SpeciesName=Bird] Non_Mammal [type=Cold-Blooded , name=Claudia , year=2014 , birthBalance=20 , SpeciesName=Squid] Non_Mammal [type=Cold-Blooded , name=Ryan , year=2014 , birthBalance=21 , SpeciesName=fish] Non_Mammal [type=Warm-Blooded , name=Ray , year=2011 , birthBalance=30 , SpeciesName=Bird] Non_Mammal [type=Cold-Blooded , name=casper , year=1998 , birthBalance=88 , SpeciesName=Snake] Non_Mammal [type=Cold-Blooded , name=Ryan2 , year=2014 , birthBalance=110 , SpeciesName=fish] Non_Mammal [type=Cold-Blooded , name=Ryan3 , year=2014 , birthBalance=110 , SpeciesName=fish] Non_Mammal [type=Warm-Blooded , name=Annie2 , year=2011 , birthBalance=120 , SpeciesName=Bird] Non_Mammal [type=Warm-Blooded , name=Annie3 , year=2011 , birthBalance=120 , SpeciesName=Bird] Non_Mammal [type=Warm-Blooded , name=Ray2 , year=2011 , birthBalance=130 , SpeciesName=Bird] Non_Mammal [type=Warm-Blooded , name=Ray3 , year=2011 , birthBalance=130 , SpeciesName=Bird] Non_Mammal [type=Cold-Blooded , name=casper2 , year=1998 , birthBalance=188 , SpeciesName=Snake] Non_Mammal [type=Cold-Blooded , name=casper3 , year=1998 , birthBalance=188 , SpeciesName=Snake] Non_Mammal [type=Cold-Blooded , name=Willy , year=2012 , birthBalance=250 , SpeciesName=Snake] Non_Mammal [type=Cold-Blooded , name=Willy , year=2012 , birthBalance=250 , SpeciesName=Snake] Non_Mammal [type=Cold-Blooded , name=Willy2 , year=2012 , birthBalance=250 ,
  • 8. SpeciesName=Snake] Non_Mammal [type=Cold-Blooded , name=Willy3 , year=2012 , birthBalance=250 , SpeciesName=Snake] Non_Mammal [type=Cold-Blooded , name=Willy2 , year=2012 , birthBalance=350 , SpeciesName=Snake] Non_Mammal [type=Cold-Blooded , name=Willy3 , year=2012 , birthBalance=350 , SpeciesName=Snake]