Write a Java object class Cat with the member variables (fields) color, breed, birthday, and weight. Create an empty constructor and overload that constructor and have it accept values for each member variable. There should be manipulator (setter) and accessor (getter) methods for each member variable. Ensure the Cat object has a toString() method. The accessor method for the birthday should return the date in the format MM/DD/YYYY. Add an accessor method getAgeInYears() that calculates how many years old the cat is based on the birthday. Use java.util.Date as the data type for the birthday.
import java.time.LocalDate;
import java.time.Period;
import java.util.Date;
class Cat {
private String color;
private String breed;
private double weight;
private Date birthday;
public Cat() {
}
public Cat(String aColor, String aBreed, double
aWeight, Date aBirthday) {
super();
color = aColor;
breed = aBreed;
weight = aWeight;
birthday = aBirthday;
}
public String getColor() {
return color;
}
public void setColor(String aColor) {
color = aColor;
}
public String getBreed() {
return breed;
}
public void setBreed(String aBreed) {
breed = aBreed;
}
public double getWeight() {
return weight;
}
public void setWeight(double aWeight) {
weight = aWeight;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date aBirthday) {
birthday = aBirthday;
}
public int getAgeInYears() {
LocalDate today = LocalDate.now();
//Today's date
LocalDate b =
LocalDate.of(birthday.getYear(), birthday.getMonth(),
birthday.getDay()); //Birth date
Period period = Period.between(b,
today);
return period.getYears();
}
}
public class TestCat {
public static void main(String[] args) {
Date d = new Date(1994,3,23);
Cat c = new
Cat("Black","Local",20,d);
System.out.println(c.getAgeInYears());
}
}

Write a Java object class Cat with the member variables (fields) color, breed, birthday, and weight....
JAVA programing Question 1 (Date Class): 5 Points Create a class Date with the day, month and year fields (attributes). Provide constructors that: A constructor that takes three input arguments to initialize the day, month and year fields. Note 1: Make sure that the initialization values for the day, month and year fields are valid where the day must be between 1 and 31 inclusive, the month between 1 and 12 inclusive and the year a positive number. Note 2:...
Language is JAVA.
Clarification for the Shape class (highlighted):
The following requirements specify what fields you are expected
to implement in your Shape class;
- A private String color that specifies the color of the
shape
- A private boolean filled that specifies whether the shape is
filled
- A private date (java.util.date) field dateCreated that
specifies the date the shape was created Your Shape class will
provide the following constructors;
- A two-arg constructor that creates a shape
with...
Room Class....... in JAVA!!!!! Write a class named Room that has the following fields: Length: Double variable that holds the rooms length(in feet). Breadth: The double variable that holds the rooms breadth(in feet). Height: Double variable that holds rooms height in feet. Color: String object that holds the color you want the room to be painted with. The class should have a constructor to initialize the fields for a particular instance (or object) of the class as given: All double...
java Write a class named Car that has the following fields: • yearModel: The yearModel field is an int that holds the car's year model. • make: The make field is a String object that holds the make of the car. • speed: The speed field is an int that holds the car's current speed. In addition, the class should have the following methods: • Constructor: The constructor should accept the car's year model and make as arguments. These values...
Design a JAVA program with the class named Computer that creates a computer object that stores the computer's brand, model, memory (in GB) and storage (in GB). The class must contain the following instance variables and methods. All variable and method names must match the specifications listed below exactly. Instance Variables: - a String variable named brand - a String variable named model - an int variable named memory - an int variable named storage Methods: The accessor and mutator...
Write a java program that creates a class Car. Class Car contains the following private member fields: make, model, year, and miles. The class Car has a constructor that takes as arguments the car make, model, and year. In addition, the constructor sets miles to 100 as default. Class Car has accessors and mutators to get and set the make, model, year and miles on the car. The program should complete the following tasks: Ask the user to enter make,...
Java Create four classes: 1. An Animal class that acts as a superclass for Dog and Bird 2. A Bird class that is a descendant of Animal 3. A Dog class that is a descendant of Animal 4. A “driver” class named driver that instantiates an Animal, a Dog, and a Bird object. The Animal class has: · one instance variable, a private String variable named name · a single constructor that takes one argument, a String, used to set...
Write a Java class that implements the concept of Coins, assuming the following attributes (variables): number of quarters, number of dimes, number of nickels, and number of pennies. Include two constructors (non-argument constructor that assigns 1 to each coin, and another constructor that takes necessary arguments to create an object), needed getter and setter methods, method toString (to print coins objects in a meaningful way), and method equals (to compare two coins objects based on number of coins). Also include...
2. Create a class named Student that contains the following » idStudent. The idStudent is an int variable that holds the student's matric number. name. The name field references a String object holds the student's name. . major. The major field references a String object holds the student's major. . classification. The classification field references a String object holds the student's classification level (bongsu, kecil, muda, sulung) . Constructor should accept the student's matric number, name, major and classification as...
Java Program Write a class named Car that has the following fields: yearModel- The yearModel field is an int that holds the car’s year model. make- The make field is a String object that holds the make of the car, such as “Ford”, “Chevrolet”, etc. speed- This speed field is an int that holds the car’s current speed. In addition, the class should have the following methods: Constructor- The constructor should accept the car’s year model and make as arguments....