Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Open IntelliJ and create a new project. When selecting the project location, choose the folder winter20-zoo that you just cloned from GitHub. Review the existing

  1. Open IntelliJ and create a new project. When selecting the project location, choose the folder winter20-zoo that you just cloned from GitHub.
  2. Review the existing code in the project (but don't change anything yet). Note the following classes:
    • Animal - This is the superclass of all animals in the zoo. Every animal has a name and can introduce itself by name.
    • ZooMain - This is the class that contains the main method in which every animal introduces itself.
    • Reindeer - This is a sample animal class that is a subclass of Animal - notice that it extends Animal. The reindeer has a noseColor property that is specific to reindeer. Reindeer overrides the introduce method in Animal to include not only its name (by calling super.introduce()) but also its special property noseColor in its introduction.
    • Depending on when you clone the repository, there may be a variety of other classes in the project that other students have already contributed and the instructor has merged.
  3. Run the main method in ZooMain to see what the output is.
  4. Your task is to add an animal to the zoo based on the Issue you selected.
  5. You will be following the steps to Add Features and Open Pull Request, but will not merge your pull request.
  6. Before you add or change any code, create a branch for your feature. Name the branch after your animal. E.g.,
    git branch lion git checkout lion
  7. Commit periodically as you work on your feature.
  8. Add a class for your animal.
    • Examples: A lion could have a roarVolume (String such as "loud", "soft"); a zebra could have a numberOfStripes (int).
    1. Name the class after your animal species, e.g., Lion.
    2. Make your class a subclass of Animal.
    3. Add a property to your class that is specific to your animal. Feel free to be creative.
    4. In your animal species class, override Animal's introduce() method. Start by calling super.introduce() so the animal's name will be included in their introduction. Then write a statement that prints a sentence including the animal's species and its custom property.
  9. Update the main method in ZooMain to create an animal from your new class and introduce itself.
  10. Remember to Test.
  11. When everything works and looks good, push your branch to GitHub. E.g.,
    git push origin lion
  12. On GitHub, create a pull request for your branch. In the pull request message, including the text "Closes #x" where x is your Issue number. This will cause the issue to be automatically closed when your feature is merged.
  13. Do not merge your pull request. The instructor will merge pull requests after reviewing them.
  14. Look at the open pull requests (if you are the first, there may not be any yet - you'll have to check back). Review someone else's pull request and write a comment on their pull request. If you see any problems you can let them know. If everything looks good you can say so.

here's the codes for winter20-zoo

Animal.java

/**
* An animal in a zoo
*
* @author
* @version 2020.02.01
*/
public class Animal {
private String name;
/**
* Create a zoo animal with the given name
* @param name
*/
public Animal(String name) {
this.name = name;
}
/**
* @return this animal's name
*/
public String getName() {
return name;
}
/**
* Print a message introducing this animal
*/
public void introduce() {
System.out.println("Hi, my name is " + name + ".");
}
}

Reindeer.java

/**
* A reindeer in a zoo
* @author
* @version 2020.02.01
*/
public class Reindeer extends Animal {
private String noseColor;
/**
* Create a reindeer with the given name and nose color
* @param name
* @param noseColor
*/
public Reindeer(String name, String noseColor) {
super(name);
this.noseColor = noseColor;
}
@Override
public void introduce() {
super.introduce();
System.out.println("I'm a reindeer with a " + noseColor + " nose.");
}
}

ZooMain.java

/**
* Introduce all the animals in the zoo
*
* @author PoChin Cheng
* @version 2020.02.01
*/
public class ZooMain {
public static void main(String[] args) {
System.out.println("---------- Zoo Animals, Introduce Yourselves: ----------");
Reindeer reindeer = new Reindeer("Rudolph", "red");
reindeer.introduce();
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mastering Influxdb Database A Comprehensive Guide To Learn Influxdb Database

Authors: Cybellium Ltd ,Kris Hermans

1st Edition

B0CNGGWL7B, 979-8867766450

More Books

Students also viewed these Databases questions

Question

What is the difference between a public and a private corporation?

Answered: 1 week ago