Advertisement
akosiraff

Download Pet Project

Feb 24th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1.  
  2. Download: http://solutionzip.com/downloads/pet-project/
  3. For this program you will create a system of classes to support a Veterinary Clinic. Your program should consist of the following classes:
  4. • Pet class: create a class to maintain a Pet record. You must maintain the following information about a Pet:
  5. o name of the pet
  6. o owner’s name of the pet
  7. o weight of the pet
  8. o number of visits
  9. o total cost of all visits to the vet
  10. 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).
  11. The class should also contain a toString() method (see sample output for how this should print).
  12. • 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.
  13. • 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.
  14. • 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.
  15. • 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
  16. {
  17. // Find out how many items are in the database
  18. public int size();// Display the items in the database on the screen
  19. public void display();// Find a particular item in the database
  20. public Pet find(String petName);/* Add an item to the database, if there is room
  21. return true if added, false otherwise
  22. */
  23. public boolean add(Pet p);/* Delete an item from the database, if it is there
  24. return true if deleted, false otherwise
  25. */
  26. public boolean delete(Pet p);
  27. }
  28. 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:
  29. Lakeside Clinic Pet List
  30. Zoey : Mr. Ed : 100.0 lbs : 0 visit(s)
  31. Fido : John : 50.0 lbs : 0 visit(s) [small Dog]
  32. Fluffy : Susie : 10.0 lbs : 0 visit(s) [Outside Cat]
  33. Kira : Patrick : 70.0 lbs : 0 visit(s) [large Dog]
  34. Mugsy : Phil : 12.0 lbs : 0 visit(s) [Inside Cat]Lakeside Clinic Pet List
  35. Zoey : Mr. Ed : 100.0 lbs : 2 visit(s), Average Cost / visit: $145.0
  36. Fido : John : 50.0 lbs : 2 visit(s), Average Cost / visit: $160.0 [small Dog]
  37. Fluffy : Susie : 10.0 lbs : 2 visit(s), Average Cost / visit: $195.0 [Outside Cat]
  38. Kira : Patrick : 70.0 lbs : 1 visit(s), Average Cost / visit: $135.0 [large Dog]
  39. 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:
  40. Mugsy
  41. 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:
  42. FluffyPlease enter the name of the pet you would like to delete:
  43. Doggy
  44. Pet not found.Lakeside Clinic Pet List
  45. Zoey : Mr. Ed : 100.0 lbs : 2 visit(s), Average Cost / visit: $145.0
  46. Fido : John : 50.0 lbs : 2 visit(s), Average Cost / visit: $160.0 [small Dog]
  47. Mugsy : Phil : 12.0 lbs : 1 visit(s), Average Cost / visit: $105.0 [Inside Cat]
  48. Kira : Patrick : 70.0 lbs : 1 visit(s), Average Cost / visit: $135.0 [large Dog]
  49. Download: http://solutionzip.com/downloads/pet-project/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement