Problem

Visit www.myprogramminglab.com to complete select Exercise online and get instant feedback...

Visit www.myprogramminglab.com to complete select Exercise online and get instant feedback.

Exercise

Your vet’s office is using the Pet class defined in Display 1 and would like to include a way to calculate the dosage amount for drugs that are commonly administered for dogs and cats. Make the following modifications to the class:

• Add an instance variable that indicates if the type of the pet is a dog or a cat.

• Modify the constructor and the set method to include the type of pet (i.e., dog or cat).

Add a method named acepromazine() that returns as a double the dosage in ml for the sedative acepromazine.

Add a method named carprofen() that returns as a double the dosage in ml for the pain killer carprofen.

The dosage calculation is

Weight is in pounds.

For acepromazine, use mg per ml = 10, and mg per kg = 0.03 for dogs and 0.002 for cats.

For carprofen, use mg per ml = 12, and mg per kg = 0.5 for dogs and 0.25 for cats.

Modify the main method in Display 2 to include tests of the new methods.

Display 1

A Class for Pet Records

Display 2

Using Constructors and Set Methods

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 4