SlideShare a Scribd company logo
1 of 9
Application: Animal Characteristics
In today’s fast-paced world, it is important for programmers to
think about potential
future changes that impact their programs. One way that
software developers can
address this concern is by designing programs that are easy to
upgrade and are
adaptable to new technologies. In this Application, you work
toward this goal by writing
a program that uses the concept of inheritance to allow for later
additions.
For this Application:
Create a program using the principles of inheritance based on
the following scenario:
Scenario: The teachers of a local school need a program to teach
their students the
basics about animals and their characteristics. The teachers
want the program to
contain a database of animals, from which the teachers can
choose animals to add to a
list. The list will be displayed on the students’ monitors so they
can study the animals
and their characteristics. Right now, the teachers want a
program that handles only
mammals and birds, but in the future they may want to add
other types of animals. The
teachers also expect the program to run smoothly and be
thoroughly tested to handle
extraneous input.
Create a program that fulfills the specifications outlined in the
scenario above. Use the
concept of inheritance to allow for later additions to the
program. Also use the TDD
concepts from Unit 1 to test the program as you go.
Follow the steps below to create the program:
Create a class Animal with these variables:
Add these methods:
strings
“I walk on four legs.” or “I run on four legs.” depending on
whether fast is false or true, respectively.
Create two classes, Mammal and Bird, each of which extends
Animal.
In the constructor for Mammal, set the variable integument to
the string “hair”. Do
not declare the variable again; it has already been declared in
Animal. Similarly, in the
constructor for Bird, set integument to the string “feathers”.
In the Bird class, override the movement method to return either
“I walk on two
legs.” or “I fly.” depending on the setting of the fast parameter.
Use the
@Override annotation.
Create additional classes to represent specific kinds of animals
(each extends either
Mammal or Bird). In each class, set the kind variable and
override the sound()
method. For example, you might create a Duck class, setting the
kind to “duck” and
overriding the sound() method to return the string “„quack‟” (in
single quotes).
Note: Remember to test the methods as you go. Use the
principles of TDD that you
examined in Unit 1. The methods you write in this program are
simple and only return
strings, so they are relatively easy to test.
Users should be able to create animals of any kind you have
defined (duck, cow, etc.),
but you should also prevent the user from creating a “plain”
animal, because there's no
such thing. Every animal has to be a specific kind. Do this by
writing a factory method in
the Animal class—that is, a method to create objects of various
animal kinds. Here's
how:
t, prevent users from creating a “plain” animal by writing
a no-argument
constructor for Animal, but making it private.
takes the
desired kind of animal (such as “duck”), calls the constructor
for that particular
kind of animal, and returns the result. If given an unrecognized
string, the method
should not crash; it should return null.
Your test of the newInstance method must verify that the
objects it creates are equal
to objects created by calling the appropriate constructor (for
instance, new Duck())
directly. Testing equality (that is, calling assertEquals) requires
an equals method in
the Animal class. There are five different characteristics that
should be equal for two
animals to be equal—their kinds, their integuments, their slow
and fast movements, and
the sounds they make. You don't need to test for every kind of
animal you define, but
you should test at least one kind of bird and one kind of
mammal. Also, don't forget to
test the newInstance method with an unrecognized (or
misspelled) kind of animal.
Write a print method in your Animal class. When called, it
should print out all the
information about “this” animal, for instance:
I am a duck.
I have feathers.
When I go slowly, I walk on two legs.
When I go fast, I fly.
The sound I make is „quack‟.
Note that the sound of the animal has single quotes around it
when you see it displayed
in the output of your program. The sound method returns a
string which contains a
single quote, the sound, and then another single quote.
Write a class called AnimalStuff containing a main method. In
this class, define an
ArrayList of Animal.
In case you are not familiar with ArrayList, you need to import
java.util.ArrayList and your declaration should look something
like
ArrayList<Animal> myList = new ArrayList<Animal>();
Although a normal array has a fixed size which you specify, an
ArrayList does not
and can grow as elements are added to it. You can find more
information about
ArrayList in the Java API.
An ArrayList<Animal> can hold a mixture of all kinds of
animals.
Finally, in your main class, write a loop asking the user which
of three things to do: Add
an animal of a chosen type to the list, print (every animal in)
the list, or quit the
program. If the user asks for an animal your program doesn't
recognize, don't add null
to the list, but do inform the user of the problem.
Use a Scanner (import java.util.Scanner) to read input from the
user. First,
create a Scanner object:
Scanner scanner = new Scanner(System.in);
Then, to read a word typed in by the user, you can use the
following:
String word = scanner.next();
To read in an entire line, use:
String line = scanner.nextLine();
To read in an integer, use:
int number = scanner.nextInt();
To read in a floating-point number, say:
double fpNumber = scanner.nextDouble();
Include screenshots of your program running as part of your
submission. Show five
valid animals being added and two invalid animals trying to be
added. Also show
screenshots of the printed list after each animal is added.
Include screenshots of your
program being tested with JUnit.
Save your NetBeans Project and screen shots of the working
program as a ".zip" file.

More Related Content

Similar to Application Animal Characteristics In today’.docx

Preexisting code, please useMain.javapublic class Main { p.pdf
Preexisting code, please useMain.javapublic class Main {    p.pdfPreexisting code, please useMain.javapublic class Main {    p.pdf
Preexisting code, please useMain.javapublic class Main { p.pdf
rd1742
 
Please Please Please Read the instructions and do everything li.docx
Please Please Please Read the instructions and do everything li.docxPlease Please Please Read the instructions and do everything li.docx
Please Please Please Read the instructions and do everything li.docx
tienmixon
 
Think-Aloud Protocols
Think-Aloud ProtocolsThink-Aloud Protocols
Think-Aloud Protocols
butest
 

Similar to Application Animal Characteristics In today’.docx (19)

ECET 370 Exceptional Education - snaptutorial.com
ECET 370 Exceptional Education - snaptutorial.com ECET 370 Exceptional Education - snaptutorial.com
ECET 370 Exceptional Education - snaptutorial.com
 
Collections and generic class
Collections and generic classCollections and generic class
Collections and generic class
 
Preexisting code, please useMain.javapublic class Main { p.pdf
Preexisting code, please useMain.javapublic class Main {    p.pdfPreexisting code, please useMain.javapublic class Main {    p.pdf
Preexisting code, please useMain.javapublic class Main { p.pdf
 
Overview of Java
Overview of Java Overview of Java
Overview of Java
 
1.3 variables
1.3   variables1.3   variables
1.3 variables
 
Please Please Please Read the instructions and do everything li.docx
Please Please Please Read the instructions and do everything li.docxPlease Please Please Read the instructions and do everything li.docx
Please Please Please Read the instructions and do everything li.docx
 
ACM init() Day 6
ACM init() Day 6ACM init() Day 6
ACM init() Day 6
 
Think-Aloud Protocols
Think-Aloud ProtocolsThink-Aloud Protocols
Think-Aloud Protocols
 
encapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloadingencapsulation, inheritance, overriding, overloading
encapsulation, inheritance, overriding, overloading
 
java_inheritance.pdf
java_inheritance.pdfjava_inheritance.pdf
java_inheritance.pdf
 
Nairobi JVM meetup : Introduction to akka
Nairobi JVM meetup : Introduction to akkaNairobi JVM meetup : Introduction to akka
Nairobi JVM meetup : Introduction to akka
 
Software fundamentals
Software fundamentalsSoftware fundamentals
Software fundamentals
 
E3
E3E3
E3
 
Think with java
Think with javaThink with java
Think with java
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
Lect 8 learning types (M.L.).pdf
Lect 8 learning types (M.L.).pdfLect 8 learning types (M.L.).pdf
Lect 8 learning types (M.L.).pdf
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Collections
CollectionsCollections
Collections
 
Lab pro
Lab proLab pro
Lab pro
 

More from hallettfaustina

Nonclassified DataIn order to maintain transparency and et.docx
Nonclassified DataIn order to maintain transparency and et.docxNonclassified DataIn order to maintain transparency and et.docx
Nonclassified DataIn order to maintain transparency and et.docx
hallettfaustina
 
Nonprofit v Criminal JusticeCriminal justice organizations and.docx
Nonprofit v Criminal JusticeCriminal justice organizations and.docxNonprofit v Criminal JusticeCriminal justice organizations and.docx
Nonprofit v Criminal JusticeCriminal justice organizations and.docx
hallettfaustina
 
Noah DeWaalTuesday16 Jun at 1538Manage discussion entryFou.docx
Noah DeWaalTuesday16 Jun at 1538Manage discussion entryFou.docxNoah DeWaalTuesday16 Jun at 1538Manage discussion entryFou.docx
Noah DeWaalTuesday16 Jun at 1538Manage discussion entryFou.docx
hallettfaustina
 
North American Philosophical Publications Prejudice i.docx
North American Philosophical Publications  Prejudice i.docxNorth American Philosophical Publications  Prejudice i.docx
North American Philosophical Publications Prejudice i.docx
hallettfaustina
 
Non-governmental Organizations (NGOs) are essential as they fulfill .docx
Non-governmental Organizations (NGOs) are essential as they fulfill .docxNon-governmental Organizations (NGOs) are essential as they fulfill .docx
Non-governmental Organizations (NGOs) are essential as they fulfill .docx
hallettfaustina
 
Nonverbal CommunicationCOLLAPSEDescribe a scenario in which a .docx
Nonverbal CommunicationCOLLAPSEDescribe a scenario in which a .docxNonverbal CommunicationCOLLAPSEDescribe a scenario in which a .docx
Nonverbal CommunicationCOLLAPSEDescribe a scenario in which a .docx
hallettfaustina
 
No More Backstabbing... A Faithful Scheduling Policy for Multi.docx
No More Backstabbing... A Faithful Scheduling Policy for Multi.docxNo More Backstabbing... A Faithful Scheduling Policy for Multi.docx
No More Backstabbing... A Faithful Scheduling Policy for Multi.docx
hallettfaustina
 

More from hallettfaustina (20)

No. of Failures Frequency.docx
No. of Failures           Frequency.docxNo. of Failures           Frequency.docx
No. of Failures Frequency.docx
 
Nonclassified DataIn order to maintain transparency and et.docx
Nonclassified DataIn order to maintain transparency and et.docxNonclassified DataIn order to maintain transparency and et.docx
Nonclassified DataIn order to maintain transparency and et.docx
 
No plaigarism!!! Due Saturday @ 12pm!Example included and worksh.docx
No plaigarism!!! Due Saturday @ 12pm!Example included and worksh.docxNo plaigarism!!! Due Saturday @ 12pm!Example included and worksh.docx
No plaigarism!!! Due Saturday @ 12pm!Example included and worksh.docx
 
Not all EBP projects result in statistically significant results. De.docx
Not all EBP projects result in statistically significant results. De.docxNot all EBP projects result in statistically significant results. De.docx
Not all EBP projects result in statistically significant results. De.docx
 
Nonprofit v Criminal JusticeCriminal justice organizations and.docx
Nonprofit v Criminal JusticeCriminal justice organizations and.docxNonprofit v Criminal JusticeCriminal justice organizations and.docx
Nonprofit v Criminal JusticeCriminal justice organizations and.docx
 
Noah DeWaalTuesday16 Jun at 1538Manage discussion entryFou.docx
Noah DeWaalTuesday16 Jun at 1538Manage discussion entryFou.docxNoah DeWaalTuesday16 Jun at 1538Manage discussion entryFou.docx
Noah DeWaalTuesday16 Jun at 1538Manage discussion entryFou.docx
 
No Plagiarism4-6 slides (excluding Title and Reference slides).docx
No Plagiarism4-6 slides (excluding Title and Reference slides).docxNo Plagiarism4-6 slides (excluding Title and Reference slides).docx
No Plagiarism4-6 slides (excluding Title and Reference slides).docx
 
North American Philosophical Publications Prejudice i.docx
North American Philosophical Publications  Prejudice i.docxNorth American Philosophical Publications  Prejudice i.docx
North American Philosophical Publications Prejudice i.docx
 
Non-governmental Organizations (NGOs) are essential as they fulfill .docx
Non-governmental Organizations (NGOs) are essential as they fulfill .docxNon-governmental Organizations (NGOs) are essential as they fulfill .docx
Non-governmental Organizations (NGOs) are essential as they fulfill .docx
 
Nonverbal CommunicationCOLLAPSEDescribe a scenario in which a .docx
Nonverbal CommunicationCOLLAPSEDescribe a scenario in which a .docxNonverbal CommunicationCOLLAPSEDescribe a scenario in which a .docx
Nonverbal CommunicationCOLLAPSEDescribe a scenario in which a .docx
 
No plagiarism Research paper should contains following content.docx
No plagiarism Research paper should contains following content.docxNo plagiarism Research paper should contains following content.docx
No plagiarism Research paper should contains following content.docx
 
NO PLAGIARISM MEET REQUIREMENTSCOMPLETE BY DEADLINE Wr.docx
NO PLAGIARISM MEET REQUIREMENTSCOMPLETE BY DEADLINE Wr.docxNO PLAGIARISM MEET REQUIREMENTSCOMPLETE BY DEADLINE Wr.docx
NO PLAGIARISM MEET REQUIREMENTSCOMPLETE BY DEADLINE Wr.docx
 
No plagiarism very important In a few short paragraphs, explain .docx
No plagiarism very important In a few short paragraphs, explain .docxNo plagiarism very important In a few short paragraphs, explain .docx
No plagiarism very important In a few short paragraphs, explain .docx
 
No plagiarism very important Do you feel the benefits of cloud c.docx
No plagiarism very important Do you feel the benefits of cloud c.docxNo plagiarism very important Do you feel the benefits of cloud c.docx
No plagiarism very important Do you feel the benefits of cloud c.docx
 
No plagiarism very important 5-CEHv9 Module 03 Scanning Networ.docx
No plagiarism very important 5-CEHv9 Module 03 Scanning Networ.docxNo plagiarism very important 5-CEHv9 Module 03 Scanning Networ.docx
No plagiarism very important 5-CEHv9 Module 03 Scanning Networ.docx
 
No plagiarism very importantNeed responses to my teamates discus.docx
No plagiarism very importantNeed responses to my teamates discus.docxNo plagiarism very importantNeed responses to my teamates discus.docx
No plagiarism very importantNeed responses to my teamates discus.docx
 
No More Backstabbing... A Faithful Scheduling Policy for Multi.docx
No More Backstabbing... A Faithful Scheduling Policy for Multi.docxNo More Backstabbing... A Faithful Scheduling Policy for Multi.docx
No More Backstabbing... A Faithful Scheduling Policy for Multi.docx
 
No plagiarism very importantThere are many mobile platform vulne.docx
No plagiarism very importantThere are many mobile platform vulne.docxNo plagiarism very importantThere are many mobile platform vulne.docx
No plagiarism very importantThere are many mobile platform vulne.docx
 
No more than 10 slides, including title slide, providing executive s.docx
No more than 10 slides, including title slide, providing executive s.docxNo more than 10 slides, including title slide, providing executive s.docx
No more than 10 slides, including title slide, providing executive s.docx
 
NO PLAGIARISM !Write 3 pages of descriptive essay about why you .docx
NO PLAGIARISM !Write 3 pages of descriptive essay about why you .docxNO PLAGIARISM !Write 3 pages of descriptive essay about why you .docx
NO PLAGIARISM !Write 3 pages of descriptive essay about why you .docx
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Recently uploaded (20)

Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
dusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learningdusjagr & nano talk on open tools for agriculture research and learning
dusjagr & nano talk on open tools for agriculture research and learning
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 

Application Animal Characteristics In today’.docx

  • 1. Application: Animal Characteristics In today’s fast-paced world, it is important for programmers to think about potential future changes that impact their programs. One way that software developers can address this concern is by designing programs that are easy to upgrade and are adaptable to new technologies. In this Application, you work toward this goal by writing a program that uses the concept of inheritance to allow for later additions. For this Application: Create a program using the principles of inheritance based on the following scenario: Scenario: The teachers of a local school need a program to teach their students the basics about animals and their characteristics. The teachers want the program to contain a database of animals, from which the teachers can choose animals to add to a
  • 2. list. The list will be displayed on the students’ monitors so they can study the animals and their characteristics. Right now, the teachers want a program that handles only mammals and birds, but in the future they may want to add other types of animals. The teachers also expect the program to run smoothly and be thoroughly tested to handle extraneous input. Create a program that fulfills the specifications outlined in the scenario above. Use the concept of inheritance to allow for later additions to the program. Also use the TDD concepts from Unit 1 to test the program as you go. Follow the steps below to create the program: Create a class Animal with these variables:
  • 3. Add these methods: strings “I walk on four legs.” or “I run on four legs.” depending on whether fast is false or true, respectively. Create two classes, Mammal and Bird, each of which extends Animal. In the constructor for Mammal, set the variable integument to the string “hair”. Do not declare the variable again; it has already been declared in Animal. Similarly, in the constructor for Bird, set integument to the string “feathers”. In the Bird class, override the movement method to return either “I walk on two legs.” or “I fly.” depending on the setting of the fast parameter. Use the @Override annotation. Create additional classes to represent specific kinds of animals
  • 4. (each extends either Mammal or Bird). In each class, set the kind variable and override the sound() method. For example, you might create a Duck class, setting the kind to “duck” and overriding the sound() method to return the string “„quack‟” (in single quotes). Note: Remember to test the methods as you go. Use the principles of TDD that you examined in Unit 1. The methods you write in this program are simple and only return strings, so they are relatively easy to test. Users should be able to create animals of any kind you have defined (duck, cow, etc.), but you should also prevent the user from creating a “plain” animal, because there's no such thing. Every animal has to be a specific kind. Do this by writing a factory method in the Animal class—that is, a method to create objects of various animal kinds. Here's
  • 5. how: t, prevent users from creating a “plain” animal by writing a no-argument constructor for Animal, but making it private. takes the desired kind of animal (such as “duck”), calls the constructor for that particular kind of animal, and returns the result. If given an unrecognized string, the method should not crash; it should return null. Your test of the newInstance method must verify that the objects it creates are equal to objects created by calling the appropriate constructor (for instance, new Duck()) directly. Testing equality (that is, calling assertEquals) requires an equals method in the Animal class. There are five different characteristics that should be equal for two animals to be equal—their kinds, their integuments, their slow and fast movements, and
  • 6. the sounds they make. You don't need to test for every kind of animal you define, but you should test at least one kind of bird and one kind of mammal. Also, don't forget to test the newInstance method with an unrecognized (or misspelled) kind of animal. Write a print method in your Animal class. When called, it should print out all the information about “this” animal, for instance: I am a duck. I have feathers. When I go slowly, I walk on two legs. When I go fast, I fly. The sound I make is „quack‟. Note that the sound of the animal has single quotes around it when you see it displayed in the output of your program. The sound method returns a string which contains a single quote, the sound, and then another single quote.
  • 7. Write a class called AnimalStuff containing a main method. In this class, define an ArrayList of Animal. In case you are not familiar with ArrayList, you need to import java.util.ArrayList and your declaration should look something like ArrayList<Animal> myList = new ArrayList<Animal>(); Although a normal array has a fixed size which you specify, an ArrayList does not and can grow as elements are added to it. You can find more information about ArrayList in the Java API. An ArrayList<Animal> can hold a mixture of all kinds of animals. Finally, in your main class, write a loop asking the user which of three things to do: Add an animal of a chosen type to the list, print (every animal in) the list, or quit the
  • 8. program. If the user asks for an animal your program doesn't recognize, don't add null to the list, but do inform the user of the problem. Use a Scanner (import java.util.Scanner) to read input from the user. First, create a Scanner object: Scanner scanner = new Scanner(System.in); Then, to read a word typed in by the user, you can use the following: String word = scanner.next(); To read in an entire line, use: String line = scanner.nextLine(); To read in an integer, use: int number = scanner.nextInt();
  • 9. To read in a floating-point number, say: double fpNumber = scanner.nextDouble(); Include screenshots of your program running as part of your submission. Show five valid animals being added and two invalid animals trying to be added. Also show screenshots of the printed list after each animal is added. Include screenshots of your program being tested with JUnit. Save your NetBeans Project and screen shots of the working program as a ".zip" file.