Question
Pet store The pet store program should start with the user being able to choose to adopt a pet or give a pet the to
Pet store
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
//Please Use Comment on Code************
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 petNameStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started