Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design a class that represents a dog. This class should have fields that represent the breed, the weight, the sex and the birthdate (design a

Design a class that represents a dog. This class should have fields that represent the breed, the weight, the sex and the birthdate (design a class of Date with integer fields for month, day and year). Include a constructor method with formal parameters for all of the fields, a toString method that prints all the instance variables (one per line with a simple heading, like -> Breed: German Shepherd), and an equals method to determine if one dog object is equal to another (all the instance variables of each Dog object must match to be equal make sure you have included an equals method for Date).

Derive a PetDog class from the Dog class. This class should have String fields for owner and address, a parameterized constructor, a toString method and an equals method (PetDog objects must also have all the Dog variables equal and the same owner to be equal to each other.) These two methods will override the similarly named methods in the Dog class and can make use of the parent class methods.

Write a test class that demonstrates each of your methods.

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions