Question: IN JAVA: Fix the errors then assign missing properties to the cats and create two more Cats using constructors that were not yet used. Source

IN JAVA: Fix the errors then assign missing properties to the cats and create two more Cats using constructors that were not yet used.

Source Code: (Not all in the same class)

package unit1;

enum Color {

WHITE, CREAM, FAWN, CINNAMON, CHOCOLATE, RED, LILAC, BLUE, BLACK, LAVENDER

}

public class Cat {

// Data fields

String name;

double age; // in years

Color color; // we will limit color choice

String type; // (domestic / feral)

static int numberOfCats;

// Constructors

Cat() {}

Cat(String name) {

this.name = name;

}

Cat(String name, double age, Color color, String type) {

super();

this.name = name;

this.age = age;

this.color = color;

this.type = type;

}

Cat(String name, String breed) {

this.name = name;

System.out.println(breed);

}

// Custom Methods

public static int getNumberOfCats() {

return numberOfCats;

}

String eat() {

return "favorite food";

}

boolean play(String toy) {

return false;

}

}

package catclient;

public class TestCat {

public static void main(String[] args) {

Cat prince = new Cat();

Cat betty = new Cat("Betty");

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!