| @ -0,0 +1,46 @@ | |||||
| import java.util.*; | |||||
| public class Cat extends Pet { | |||||
| private boolean allergic; | |||||
| public Cat(){ | |||||
| } | |||||
| public Cat(int petId, String name, double weight, Date dob, double accumulatedDose, boolean allergic){ | |||||
| super(petId, name, weight, dob, accumulatedDose); | |||||
| this.allergic = allergic; | |||||
| } | |||||
| //Setter | |||||
| public void setAllergic(boolean allergic){ | |||||
| this.allergic = allergic; | |||||
| } | |||||
| //Getter | |||||
| public boolean getAllergic(){ | |||||
| return this.allergic; | |||||
| } | |||||
| public double getDose(){ | |||||
| if ( getAccumulatedDose() > 500) { | |||||
| return 0; | |||||
| // }else if(getAllergic() == true){ | |||||
| // return 0; | |||||
| // }else if( findAge() >3 && weight > 0.5){ | |||||
| // return 7+0.61* getWeight(); | |||||
| }else{ | |||||
| return 0.81 * getWeight(); | |||||
| } | |||||
| } | |||||
| public String toString(){ | |||||
| return "petID=" + getPetId() + | |||||
| ", name='" + getName() + '\'' + | |||||
| ", weight=" + getWeight() + | |||||
| // ", dob=" + VetClinicConsole.dateToStr(getDob()) + | |||||
| // ", accumulatedDose=" + getAccumulatedDose() + | |||||
| ",allergic='" + allergic + '\''; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,47 @@ | |||||
| import java.util.*; | |||||
| public class Dog extends Pet { | |||||
| private String breed; | |||||
| public Dog(){ | |||||
| super(); | |||||
| this.breed = ""; | |||||
| } | |||||
| public Dog(int petId, String name, double weight, Date dob, double accumulatedDose, String breed){ | |||||
| super(petId, name, weight, dob, accumulatedDose); | |||||
| this.breed = breed; | |||||
| } | |||||
| //Setter | |||||
| public void setBreed(String breed){ | |||||
| this.breed = breed; | |||||
| } | |||||
| //Getter | |||||
| public String getBreed(){ | |||||
| return this.breed; | |||||
| } | |||||
| public double getDose(){ | |||||
| if (getAccumulatedDose() > 750){ | |||||
| return 0; | |||||
| // }else if( findAge() < 3){ | |||||
| // return 0; | |||||
| // }else if(findAge() > 12 && getWeight() <2){ | |||||
| // return 6 + 0.75 * getWeight(); | |||||
| }else{ | |||||
| return 12 + 0.65* getWeight(); | |||||
| } | |||||
| } | |||||
| public String toString(){ | |||||
| return "petID=" + getPetId() + | |||||
| ", name='" + getName() + '\'' + | |||||
| ", weight=" + getWeight() + | |||||
| // ", dob=" + VetClinicConsole.dateToStr(getDob()) + | |||||
| // ", accumulatedDose=" + getAccumulatedDose() + | |||||
| ",breed='" + breed + '\''; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,47 @@ | |||||
| import java.util.*; | |||||
| public class Dose { | |||||
| private String nameOfDrug; | |||||
| private Date date; | |||||
| private double doseInGrams; | |||||
| public Dose(){ | |||||
| this.nameOfDrug = ""; | |||||
| Date date = new Date(); | |||||
| this.date = date; | |||||
| this.doseInGrams = 0.0; | |||||
| } | |||||
| public Dose(String nameOfDrug, double doseInGrams){ | |||||
| Date date = new Date(); | |||||
| this.date = date; | |||||
| this.nameOfDrug = nameOfDrug; | |||||
| this.doseInGrams = doseInGrams; | |||||
| } | |||||
| //Setter | |||||
| public void setNameOfDrug(String nameOfDrug){ | |||||
| this.nameOfDrug = nameOfDrug; | |||||
| } | |||||
| public void setDate(Date date){ | |||||
| this.date = date; | |||||
| } | |||||
| public void setDoseInGrams(double doseInGrams){ | |||||
| this.doseInGrams = doseInGrams; | |||||
| } | |||||
| //Getter | |||||
| public String getNameOfDrug(){ | |||||
| return this.nameOfDrug; | |||||
| } | |||||
| public Date getDate(){ | |||||
| return this.date; | |||||
| } | |||||
| public double getDoseInGrams(){ | |||||
| return this.doseInGrams; | |||||
| } | |||||
| } | |||||
| @ -0,0 +1,79 @@ | |||||
| import java.util.*; | |||||
| public abstract class Pet { | |||||
| private int petId; | |||||
| private String name; | |||||
| private double weight; | |||||
| private Date dob; | |||||
| private Double accumulatedDose; | |||||
| private ArrayList<Dose> doses; | |||||
| //Constructor | |||||
| public Pet(){ | |||||
| this.doses = new ArrayList<Dose>(); | |||||
| } | |||||
| public Pet(int petId, String name, double weight, Date dob, double accumulatedDose){ | |||||
| this.petId = petId; | |||||
| this.name = name; | |||||
| this.weight = weight; | |||||
| this.dob = dob; | |||||
| this.accumulatedDose = accumulatedDose; | |||||
| this.doses = new ArrayList<Dose>(); | |||||
| } | |||||
| // Setter | |||||
| public void setPetId(int petId){ | |||||
| this.petId = petId; | |||||
| } | |||||
| public void setName(String name){ | |||||
| this.name = name; | |||||
| } | |||||
| public void setWeight(double weight){ | |||||
| this.weight = weight; | |||||
| } | |||||
| public void setDob(Date dob){ | |||||
| this.dob = dob; | |||||
| } | |||||
| public void accumulatedDose(double accumulatedDose){ | |||||
| this.accumulatedDose = accumulatedDose; | |||||
| } | |||||
| public void setDoses(ArrayList<Dose> doses){ | |||||
| this.doses = doses; | |||||
| } | |||||
| // Getter | |||||
| public int getPetId(){ | |||||
| return this.petId; | |||||
| } | |||||
| public String getName(){ | |||||
| return this.name; | |||||
| } | |||||
| public double getWeight(){ | |||||
| return this.weight; | |||||
| } | |||||
| public Date getDob(){ | |||||
| return this.dob; | |||||
| } | |||||
| public double getAccumulatedDose(){ | |||||
| return this.accumulatedDose; | |||||
| } | |||||
| public ArrayList<Dose> getDoses(){ | |||||
| return this.doses; | |||||
| } | |||||
| public int findAge(){ | |||||
| int differentMonth = 0; | |||||
| Date firstDate = this.dob; | |||||
| Date secondDate = new Date(); | |||||
| } | |||||
| // public abstract double getDose(); | |||||
| } | |||||
| @ -0,0 +1,49 @@ | |||||
| import java.util.*; | |||||
| public class VetClinic { | |||||
| private static Scanner scan; | |||||
| private static int petId = 1; | |||||
| public static void main(String[] args) { | |||||
| ArrayList<Pet> pets = new ArrayList<Pet>; | |||||
| scan = new Scanner(System.in); | |||||
| public static void printMainMenu();{ | |||||
| System.out.println("1. Adding a Pet "); | |||||
| System.out.println("2. Delete a Pet"); | |||||
| System.out.println("3. Show all Pet(s)!"); | |||||
| System.out.println("4. Add a drug for a Pet "); | |||||
| System.out.println("5. Edit information Pet "); | |||||
| System.out.println("6. Quit \n "); | |||||
| System.out.println("Your Choice: "); | |||||
| } | |||||
| int choose = scan.nextLine(); | |||||
| while (choose!= 0){ | |||||
| switch(choose){ | |||||
| case 1: | |||||
| printChoicePet(); | |||||
| case 2: | |||||
| case 3: | |||||
| case 4: | |||||
| case 5: | |||||
| case 6: | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||