Question: Chapter 3 Lab: Class and Objects For this lab, you need to create a Java project with two classes: Dog class, with the following specifications:
Chapter Lab: Class and Objects
For this lab, you need to create a Java project with two classes:
Dog class, with the following specifications:
It has the following class variables:
name: type String
age: type double
colors: array of strings recall activity class Transcript with courses array, this one is similar to that
number of colors: int you need to keep track of how many colors added
Dog class should have the following constructor and methods:
A constructor that gets the name and set the Dog object name.
A method that sets age.
A method that gets age.
A method that adds a color to colors array.
A method that prints all colors.
A method to update's dog name simply a set name method
Testdog class, with the following specifications:
It should have main method to be run.
Inside main method:
Create a Dog object you need to pass the name of dog to the constructor
Test all the methods in Dog class call each method and print what they return or the change it made in the dog object
If you are not sure about any part of the lab, feel free to go back to the activities you did in the past, for example Transcript class, Runtranscript, or other classes.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
