[1pts] Create a class Dog that has the following members (attributes)–String nameInteger ageAnd only the following constructorspublic Dog(String name, Integer age)[2pts] Create a class Person that has...

[1pts] Create a class Dog that has the following members (attributes)–String nameInteger ageAnd only the following constructorspublic Dog(String name, Integer age)[2pts] Create a class Person that has the following membersString nameInteger ageOptional dogAnd has the following constructorspublic Person (String name, Integer age) //should call the below constructorpublic Person (String name, Integer age, Dog dog)and implements the following methods[3pts]public bool hasOldDog() {//should return true IF Person has a Dog AND Dog.age >=10//lose 1 point if you use an If statement)}[3pts]public void changeDogsName(String newName) {//should change the Persons Dog’s name to the newName If the person has a Dog//Or it should throw a RuntimeException(this.name + “ does not own a dog!”)// if the person does not own a dog}[3pts]Create a Java application class (class with a main method) that- Initializes a Person class without a dog- Tries to change the person’s dogs name, catches the exception throw by changeDogsName()and outputs “Unable to change dogs name“ + exception message[8pts]Write Unit tests forDog and Person Class-Each unit tests must have at least assert-Some method may require more than one test, e.x you would want to test changeDogsName on a person that has a dog, as well as a person that does not have a dog*note Dog and Person should implement the standard Setters/Getters/Equals method
Sep 25, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here