I am having issues with creating class for my home work.
The project: Designing and implementing a class called dog that contains instance datat that represents the dogs name and age. i have to define the dog constructor to accept and initialize instance data. include getter and setter methods for the name and age. include a metod to compute and return the age of the dog in person years. include a tostring method that returns a oneline description of the dog. crate a driver class call kennel, whose main method instantiates and updates several dog objects.
So first is my dog class it is complies just fine
//******************************************************************** // Dog.java Author: Anastacia Williams // // Get and set doog name and age // // ______________________________ // name of class // Dog // ______________________________ // list of class variables // Age int // petAge int // Value int // // // // ______________________________ // list of class methods // -int // -String Dog // +Dog // +getName // +setName // +getAge // +setAge // +HumanYear // +String toString // ______________________________ // //******************************************************************** public class Dog { private int Age ; //age of animal private String Name; // name private int HumanAge; //human age //----------------------------------------------------------------- // Constructor: vallue //----------------------------------------------------------------- public Dog(String petname, int petAge, int Agetime7) { Name = petname; Age = petAge; HumanAge = Agetime7; } //----------------------------------------------------------------- // Set name //----------------------------------------------------------------- public void setName(String petname) { Name = petname; } //----------------------------------------------------------------- // get name //----------------------------------------------------------------- public String getName() { return Name; } //----------------------------------------------------------------- // set age //----------------------------------------------------------------- public void setAge(int petAge) { int Age = petAge; } //----------------------------------------------------------------- // Get age //----------------------------------------------------------------- public int getAge() { return Age; } //----------------------------------------------------------------- // Humna years. formula age times 7 //----------------------------------------------------------------- public void setHumanAge(int Agetime7) { int HumanAge = Agetime7; } public int getHumanAge() { return HumanAge; } //----------------------------------------------------------------- // Returns a string representation to dog name an age //----------------------------------------------------------------- public String toString() { return "Name of dog: " + Name + "Age of dog: " + Age + "Human age: " + HumanAge; } }
This is my kennel
//******************************************************************** // Kennel.java Author: Anastacia Williams // // Get and set doog name and age // // ______________________________ // name of class // // ______________________________ // list of class variables // None // ______________________________ // list of class methods // +main // ______________________________ // //******************************************************************** public class Kennel { //----------------------------------------------------------------- // Generate aniaml name and age. //----------------------------------------------------------------- public static void main (String[] args) { Dog dog1 = new Dog ("willy", 9, 63); System.out.println ( "First Dog " dog1.toString); } }
the errors i encounter with kennel are:
E:\New Folder\Kennel.java:32: error: ')' expected
System.out.println ( "First Dog " dog1.toString);
^
E:\New Folder\Kennel.java:32: error: illegal start of expression
System.out.println ( "First Dog " dog1.toString);
^
E:\New Folder\Kennel.java:32: error: ';' expected
System.out.println ( "First Dog " dog1.toString);
^
3 errors
Tool completed with exit code 1
Please help me