CSC 220 – Lab 9

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

Dog Class
• Design and implement a class called Dog that contains instance data that represents
the dog’s name and age. Define the Dog constructor to accept and initialize instance
data. Include getter and setter methods for the name and age. The getter names
MUST be “getName” and “getAge”. The setter names must be “setName” and
“setAge”. Include a method to compute and return the age of the dog in “person
years” (seven times the dog’s age). Include a toString method that returns a oneline description of the dog. Create a driver class called Kennel, whose main method
instantiates and updates several Dog objects.
Die Class
• Using the Die class defined in slides 07_Writing_Classes.pdf, design and implement
a class called PairOfDice, composed of two Die objects. Include methods to set and
get the individual die values, a method to roll the dice, and a method that returns
the current sum of the two die values. Create a driver class called RollingDice2 to
instantiate and use a PairOfDice object. The driver should call each method of the
PairOfDice object.
What to turn in:
JAR your *.java files into a file called Lab9.jar. When you’re done, submit the
file to Canvas by the deadline. No extensions.