Create a new class called Dog that is derived from the Pet class given in Listing 6.1 of Chapter 6. The new class has the additional attributes of breed (type String) and boosterShot (type boolean), which is true if the pet has had its booster shot and false if not. Give your classes a reasonable complement of constructors and accessor methods. Write a driver program to test all your methods, then write a program that reads in five pets of type Dog and displays the name and breed of all dogs that are over two years old and have not had their booster shots.

This project would be easier to do with an array of type Dog, but how to write class constructors for arrays has not been covered, so the code to process one dog has to be repeated five times.


See the code in Dog.java, DogTest.java, and DogBoosterShotList,java.

Computer Science & Information Technology

You might also like to view...

An assertion

a) is never more than just comment embedded in code b) are always easily and precisely stated with C++ syntax, c) is used to document and check correctness in programs d) is typically a precondition or postcondition for a function e) if converted to a Boolean statement, may be used with the library assert macro to test whether the assertion is satisfied at that point in the code.

Computer Science & Information Technology

To group objects means to select two or more objects, then make them into one selectable object by clicking Group on the ____ menu.

A. Group B. Object C. Tools D. Arrange

Computer Science & Information Technology

What is the file extension for a customization file that offers a new, customized Ribbon available on other computers?

A) .export B) .cust C) .UIRibbon D) .exportedUI

Computer Science & Information Technology

If you save a presentation with a .pptx file extension, it will open in ________ view in PowerPoint 2013

A) Presenter B) Slide Sorter C) Normal D) Slide Show

Computer Science & Information Technology