Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Animal class has a default constructor, a constructor with two parameters, and a constructor with three parameters. Declare the following objects: animal 1 with

The Animal class has a default constructor, a constructor with two parameters, and a constructor with three parameters. Declare the following objects:
animal1 with no arguments
animal2 with animalType and animalColor as arguments
animal3 with animalType, animalColor, and animalAge as arguments
Ex: If the input is deer yellow 6, then the output is:
Animal: Undefined, Unknown, 0
Animal: deer, yellow, 0
Animal: deer, yellow, 6
MyAnimals.java
Animal.java
import java.util.Scanner;
public class MyAnimals {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
String animalType;
String animalColor;
int animalAge;
animalType = scnr.next();
animalColor = scnr.next();
animalAge = scnr.nextInt();
/* Your code goes here */
animal1.print();
animal2.print();
animal3.print();
}
}

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

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions

Question

b. If n is even, let F = 0.5n, 0.5n + 1,, 0, 1,, 0.5n 1 / n.

Answered: 1 week ago