Question: The pet store program should start with the user being able to choose to adopt a pet or give a pet the to the shop.
The pet store program should start with the user being able to choose to adopt a pet or give a pet the to the shop. If the user wants to adopt a pet, they should be able to see either all available pets, unless they say they know what type of pet they want, then show only available pets of that type.
The 4 methods that will need to be created for this program should:
1. add new pets
2. get a pet adopted
3.show pets by type
4. show pets available for adoption Object Class: Pets.java************************************
**********The object class should be Pets.java
************Must (use source) code below to answer question/ please Copy and add********** This is essential, hence the question will not be accepted
**********Please Use Comments on code to explain steps

import java.util.*;
public class Pets { private double age; //age of the animal (e.g. for 6 months the age would be .5) private String petName; /ame of the animal private String aType; //the type of the pet (e.g. "bird", "dog", "cat", "fish", etc) private int collarID; //id number for the pets private boolean isAdopted = false; //truth of if the pet has been adopted or not private String newOwner; private Date adoptionDate;
public Puppy(String pName, double pAge, String type) { petName = pName; age = pAge; aType = type; }
public void adoptPet(String owner, Date adoptionDate, int pID){ boolean isAdopted = true; newOwner = owner; this.adoptionDate = adoptionDate; collarID = pID; } public String getPetType(){ return aType; } public int getPetAge(){ return age; } public String getPetName(){ return petName; } }
3 public class Pets t private double age; private String petName; /ame of the animal private String aType; private int collarID; private boolean isAdopted-false; //truth of if the pet has been adopted or not private String newOwner private Date adoptionDate; 4 //age of the animal (e.g. for 6 months the age would be .5) //the type of the pet (e.g. "bird", "dog", "cat", "fish", etc) 6 7 8 9 //id number for the pets 12 public Puppy (String pName, double pAge, String type) petName -pName; age pAge; a lype type 16 17 18 19 20 21 public void adoptPet (String owner, Date adoptionDate, int pID) boolean isAdopted-true; newOwner- owner this.adoptionDate-adoptionDate; collarIDpID; 23 24 25 26 27 28 29 public String getPetType ) return aType; public int getPetAge return age; 31 32 public String getPetName) 34 35 36 37 38 return petName
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
