Pet Project

Download Category:

Pet_Project.zip - (170.43 KB)
[
Pet_Project/.classpath
Pet_Project/.project
Pet_Project/Cat.class
Pet_Project/Cat.java
Pet_Project/Database.class
Pet_Project/Database.java
Pet_Project/Dog.class
Pet_Project/Dog.java
Pet_Project/Driver.class
Pet_Project/Driver.java
Pet_Project/Pet.class
Pet_Project/Pet.java
Pet_Project/Question.txt
Pet_Project/Screenshot_1.jpg
Pet_Project/Vet.class
Pet_Project/Vet.java
]

For this program you will create a system of classes to support a Veterinary Clinic. Your program should consist of the following classes:
• Pet class: create a class to maintain a Pet record. You must maintain the following information about a Pet:
o name of the pet
o owner’s name of the pet
o weight of the pet
o number of visits
o total cost of all visits to the vet
The class should have proper getters and setters with the exception that there should not be a set method for the total cost of all visits or number of visits (these attributes should only be modified through the visit method).
The class should also contain a toString() method (see sample output for how this should print).
• Cat class: is a subclass of the Pet class; include an instance data member that keeps track of whether this is an inside only cat, or if it sometimes goes outside.
• Dog class: is a subclass of the Pet class; include an instance data member to classify the dog as a small, medium, or large breed.
• visit method: The Pet class must contain a method called visit that is called each time the pet visits the vet. This method will help keep track of the number of visits as well as the total cost of all visits to the vet. For all Pets, the standard cost is $85 plus $30 times the number of shots. The visit method will take the number of shots as a parameter. For Cats, there is an additional charge of $20 to clean the teeth (which we will assume is done every visit), and an extra shot for outside cats (again, done every visit). For Dogs there is an additional charge of $15 to trim the nails (every time), and surcharges of $2.50/shot for medium size breeds and $5/shot for large breeds.
• Vet class: holds the name of the veterinary clinic and holds a collection of Pets. This class must implement the Database.java interface (below). This means the vet class must provide all the capabilities laid out in the Database.java class (e.g. find, delete, etc).public interface Database
{
// Find out how many items are in the database
public int size();// Display the items in the database on the screen
public void display();// Find a particular item in the database
public Pet find(String petName);/* Add an item to the database, if there is room
return true if added, false otherwise
*/
public boolean add(Pet p);/* Delete an item from the database, if it is there
return true if deleted, false otherwise
*/
public boolean delete(Pet p);
}
On the next page is sample output you should receive using the provided driver class. User input is shown in green. Your output should be identical.Sample Output:
Lakeside Clinic Pet List
Zoey : Mr. Ed : 100.0 lbs : 0 visit(s)
Fido : John : 50.0 lbs : 0 visit(s) [small Dog]
Fluffy : Susie : 10.0 lbs : 0 visit(s) [Outside Cat]
Kira : Patrick : 70.0 lbs : 0 visit(s) [large Dog]
Mugsy : Phil : 12.0 lbs : 0 visit(s) [Inside Cat]Lakeside Clinic Pet List
Zoey : Mr. Ed : 100.0 lbs : 2 visit(s), Average Cost / visit: $145.0
Fido : John : 50.0 lbs : 2 visit(s), Average Cost / visit: $160.0 [small Dog]
Fluffy : Susie : 10.0 lbs : 2 visit(s), Average Cost / visit: $195.0 [Outside Cat]
Kira : Patrick : 70.0 lbs : 1 visit(s), Average Cost / visit: $135.0 [large Dog]
Mugsy : Phil : 12.0 lbs : 1 visit(s), Average Cost / visit: $105.0 [Inside Cat]Please enter the name of the pet you would like to find:
Mugsy
Mugsy : Phil : 12.0 lbs : 1 visit(s), Average Cost / visit: $105.0 [Inside Cat]Please enter the name of the pet you would like to delete:
FluffyPlease enter the name of the pet you would like to delete:
Doggy
Pet not found.Lakeside Clinic Pet List
Zoey : Mr. Ed : 100.0 lbs : 2 visit(s), Average Cost / visit: $145.0
Fido : John : 50.0 lbs : 2 visit(s), Average Cost / visit: $160.0 [small Dog]
Mugsy : Phil : 12.0 lbs : 1 visit(s), Average Cost / visit: $105.0 [Inside Cat]
Kira : Patrick : 70.0 lbs : 1 visit(s), Average Cost / visit: $135.0 [large Dog]

Write a Review

Get a fresh solution of this question. Ask it now to our experts.
doubt

Ask Your Question

We have verified professionals who are ready to answer your question.

time

Save Time and Money

We choose experts who can quickly answer your question and that suit your budget.

download

Get Your Answer

Your satisfaction is 100% guaranteed. You can keep on asking questions until you get the answer you need.