You must create two Java files. One is called LastNameFirstNameWeek6Prog.java,and the other is called Horse.java.
Ensure you include ALL files required to make your program compile and run. I would like to see your .java files only.
Horse.java Class File
1. Create a new class called Horse that includes the functionality below
2. The new class has the attributes of:
name - Horse's name, type String
age - age of Horse in years, type integer
height - height of Horse in meters, type double
color - type Horse's color, type String
pureBlood - type boolean - true if Horse is pure blood, false if not
3. Be sure your classes have a good set of accessor and mutator methods. Every member variable must have at least one independent accessor and one independent mutator.
4. Example:
public void setName(String name) mutator used to set name
public void seAge(int age) mutator used to set the age
//.... Add other mutator methods here
public String getName() accessor used to get name
public int getAge() accessor used to get age
//.... Add other accessor methods here
Ensure you use the "this" reference from within this class when referring to every instance variable or instance method of the current object.
LastNameFirstNameWeek6Prog.java Class File (Driver Program)
Write a driver program that reads in 3 animals of type Horse and prints out the name, age and height of all non pure blood Horse objects that are 4 or more years old. The following information should be read per Horse:
name
age
height
color
pureBlood
Conditional statements should be used to decide which Horse's information should be printed.
Use accessor methods to check the age and pure blood status on each Horse.