Giter VIP home page Giter VIP logo

java-animalkingdom's Introduction

Sprint 1 - Module 2 - Module Project - Animal Kingdom Search

A student that completes this project shows that they can:

  • craft and manipulate Collections
  • craft and manipulate ArrayList Collections
  • use and implement interfaces
  • use and implement Lambda Expressions
  • use and implement abstract classes

Introduction

Using a combination of abstract classes, an interface, sorting, and lambda expressions, students will create and manipulate a list of animals using object-oriented design principles.

Instructions and Completion Requirements

  • Please fork and clone this repository. This repository does not have a starter project, so create one inside of the cloned repository folder. Regularly commit and push your code as appropriate.

  • Create an abstract class for animals

    • All animals consume food the same way
    • Each animal is assigned a unique number as an id, a name, and a year named, regardless of classification.
  • Methods will return a string saying how that animal implements the action

    • All animals can move, breathe, reproduce. How they do that varies by animal type. This variation means that the string that gets returned by a method is different for each animal type (mammals, birds, fish).
  • Create classes for mammals, birds, fish

    • Mammals move by walking, breath with lungs, and reproduce via live births
    • Birds move by flying, breath with lungs, and reproduce via eggs
    • Fish move by swimming, breath with gills, and reproduce via eggs

Hint: think about abstract classes and creating an ArrayList using an abstract class type.

Create a collection for the animals using the following data. You will have one collection of animals; this collection will contain mammals, birds, and fish.

  • Mammals:

    Name Year Named
    Panda 1869
    Zebra 1778
    Koala 1816
    Sloth 1804
    Armadillo 1758
    Raccoon 1758
    Bigfoot 2021
  • Birds:

    Name Year Named
    Pigeon 1837
    Peacock 1821
    Toucan 1758
    Parrot 1824
    Swan 1758
  • Fish:

    Name Year Named
    Salmon 1758
    Catfish 1817
    Perch 1758
  • Using Lambda Expressions and displaying the results to the console:

    • List all the animals in descending order by year named
    • List all the animals alphabetically
    • List all the animals in order by how they move
    • List only those animals the breath with lungs
    • List only those animals that breath with lungs and were named in 1758
    • List only those animals that lay eggs and breath with lungs
    • List alphabetically only those animals that were named in 1758

Note: to get your collection to print nicely to the console, you may have to override the toString method on the class that you design.

  • Stretch Goal
    • For the list of animals, list alphabetically those animals that are mammals.

Results

MVP

The MVP of this application would produce the following output.

*** MVP ***

*** List all the animals in descending order by year named ***
[Animals{id=6, name='Bigfoot', yearNamed=2021}
, Animals{id=0, name='Panda', yearNamed=1869}
, Animals{id=7, name='Pigeon', yearNamed=1837}
, Animals{id=10, name='Parrot', yearNamed=1824}
, Animals{id=8, name='Peacock', yearNamed=1821}
, Animals{id=13, name='Catfish', yearNamed=1817}
, Animals{id=2, name='Koala', yearNamed=1816}
, Animals{id=3, name='Sloth', yearNamed=1804}
, Animals{id=1, name='Zebra', yearNamed=1778}
, Animals{id=4, name='Armadillo', yearNamed=1758}
, Animals{id=5, name='Raccoon', yearNamed=1758}
, Animals{id=9, name='Toucan', yearNamed=1758}
, Animals{id=11, name='Swan', yearNamed=1758}
, Animals{id=12, name='Salmon', yearNamed=1758}
, Animals{id=14, name='Perch', yearNamed=1758}
]

*** List all the animals alphabetically ***
[Animals{id=4, name='Armadillo', yearNamed=1758}
, Animals{id=6, name='Bigfoot', yearNamed=2021}
, Animals{id=13, name='Catfish', yearNamed=1817}
, Animals{id=2, name='Koala', yearNamed=1816}
, Animals{id=0, name='Panda', yearNamed=1869}
, Animals{id=10, name='Parrot', yearNamed=1824}
, Animals{id=8, name='Peacock', yearNamed=1821}
, Animals{id=14, name='Perch', yearNamed=1758}
, Animals{id=7, name='Pigeon', yearNamed=1837}
, Animals{id=5, name='Raccoon', yearNamed=1758}
, Animals{id=12, name='Salmon', yearNamed=1758}
, Animals{id=3, name='Sloth', yearNamed=1804}
, Animals{id=11, name='Swan', yearNamed=1758}
, Animals{id=9, name='Toucan', yearNamed=1758}
, Animals{id=1, name='Zebra', yearNamed=1778}
]

*** List all the animals order by how they move ***
[Animals{id=10, name='Parrot', yearNamed=1824}
, Animals{id=8, name='Peacock', yearNamed=1821}
, Animals{id=7, name='Pigeon', yearNamed=1837}
, Animals{id=11, name='Swan', yearNamed=1758}
, Animals{id=9, name='Toucan', yearNamed=1758}
, Animals{id=13, name='Catfish', yearNamed=1817}
, Animals{id=14, name='Perch', yearNamed=1758}
, Animals{id=12, name='Salmon', yearNamed=1758}
, Animals{id=4, name='Armadillo', yearNamed=1758}
, Animals{id=6, name='Bigfoot', yearNamed=2021}
, Animals{id=2, name='Koala', yearNamed=1816}
, Animals{id=0, name='Panda', yearNamed=1869}
, Animals{id=5, name='Raccoon', yearNamed=1758}
, Animals{id=3, name='Sloth', yearNamed=1804}
, Animals{id=1, name='Zebra', yearNamed=1778}
]

*** List only those animals the breath with lungs ***
Parrot eggs fly lungs 1824
Peacock eggs fly lungs 1821
Pigeon eggs fly lungs 1837
Swan eggs fly lungs 1758
Toucan eggs fly lungs 1758
Armadillo live births walk lungs 1758
Bigfoot live births walk lungs 2021
Koala live births walk lungs 1816
Panda live births walk lungs 1869
Raccoon live births walk lungs 1758
Sloth live births walk lungs 1804
Zebra live births walk lungs 1778

*** List only those animals that breath with lungs and were named in 1758 ***
Swan eggs fly lungs 1758
Toucan eggs fly lungs 1758
Armadillo live births walk lungs 1758
Raccoon live births walk lungs 1758

*** List only those animals that lay eggs and breath with lungs ***
Parrot eggs fly lungs 1824
Peacock eggs fly lungs 1821
Pigeon eggs fly lungs 1837
Swan eggs fly lungs 1758
Toucan eggs fly lungs 1758

*** List alphabetically only those animals that were named in 1758 ***
Armadillo live births walk lungs 1758
Perch eggs swim gills 1758
Raccoon live births walk lungs 1758
Salmon eggs swim gills 1758
Swan eggs fly lungs 1758
Toucan eggs fly lungs 1758

Stretch Goal

The Stretch Goals would produce the following output.

*** Stretch Goal ***

*** For the list of animals, list alphabetically those animals that are mammals ***
Armadillo live births walk lungs 1758
Bigfoot live births walk lungs 2021
Koala live births walk lungs 1816
Panda live births walk lungs 1869
Raccoon live births walk lungs 1758
Sloth live births walk lungs 1804
Zebra live births walk lungs 1778

java-animalkingdom's People

Contributors

jrmmba8314 avatar mattmccarley avatar zoelud avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

java-animalkingdom's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.