Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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************

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Horse Betting The Road To Absolute Horse Racing 2

Authors: NAKAGAWA,YUKIO

1st Edition

B0CFZN219G, 979-8856410593

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago