Assignment title: Java


Question Java Programming assignment Q This assignment requires you to complete various tasks involving classes you write yourself. You may also use classes that you find in the SDK. The system that you will create is a Farm Management System. The Farm Management System is a tool used by a Company that manages multiple farms. Each Farm has a

name and has a Farmer who manages it. On each farm, there are numerous farm animals. This system will enable the user to add new animals to the inventory as well as view the stored list of farm animals. It will be possible to inspect details for each animal. You will be required to develop your application using Java in the Eclipse environment. You will create a GUI using the java.swing package. Within this project create a package called animalSystem.

1. Author at least four new classes within your newly created package. Two general classes to create first are Animal and Farm Animal. In addition to these, you are to create at least TWO classes

representing possible farm animals (e.g. Pig, Cow, Chicken, Lamb) that are specializations on the general class (Farm Animal). All animals have the following attributes: breed name, age (in months), and purchase price. Farm Animals also have the attributes: market value (in $) and age for

market (in months). Choose further attributes particular to each animal, for example, a Pig may have attributes such as free range (or not) and feed amount (a weight value of daily grain ration

allocated to the animal). The Cow may have dietary attributes of hay (weight ration per day) and corn (weight ration per day).

2. You must provide at least 2 constructors for each particular animal class: a. A default constructor which assigns each instance variable a default value. The String

variables (e.g. name) should be initialised to "unknown", and object fields initialised to null. b. A constructor with parameters which assign values to each instance variable. Note that the

values to initialise the values and objects should be passed in using arguments when the constructor is called. 3. Author get and set methods for your classes for each instance variable.

4. Write a toString() method that will return a String containing all the relevant data for each of your

objects. 5. Author an abstract class Person with attributes name, address. Use this class to create a specialization class of a Farmer. The Farmer has additional attributes including an ABN (Australian Business Number). 6. Author a class representing a Farm object. The Farm object will have a Farmer and a list of animals

found on the farm. 7. Create a new MainDriver class. In this class, provide a main method containing code to test both

constructors, at least one get and one set method and your toString () method. Run your test and make sure your class is behaving correctly