Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 3 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).
Test_dog 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, Run_transcript, or other classes.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What can PMT do to improve its safety practices and policies?

Answered: 1 week ago