-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPet.java
More file actions
234 lines (187 loc) · 7.75 KB
/
Pet.java
File metadata and controls
234 lines (187 loc) · 7.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
// Pet.java
// Noah Pohl
// 3-20-20
import java.util.Scanner;
public class Pet {
// Instance private Variables
private String petType;
private String petName;
private int petAge;
private int dogSpace;
private int catSpace;
private int daysStay;
private double amountDue;
// Default constructor for Pet class
public Pet(String petType, String petName, int petAge, int dogSpace, int catSpace, int daysStay, double amountDue) {
this.petType = petType;
this.petName = petName;
this.petAge = petAge;
this.dogSpace = dogSpace;
this.catSpace = catSpace;
this.daysStay = daysStay;
this.amountDue = amountDue;
}
// checkIn method
public void checkIn() {
// initial Cat space
setCatSpace(12);
// intial Cat space
setDogSpace(30);
System.out.print("Welcome, are you checking in a dog or cat:");
// input from Scanner class
Scanner input = new Scanner(System.in);
String userChoice = input.nextLine();
// determine if user is checking in a cat or dog
if (userChoice.equals("cat")) {
System.out.println("meow meow");
// check if cat space is available
if (getCatSpace() >= 1) {
System.out.println("Cat space availalbe hooray!");
System.out.println("Is your Cat a 'new' or 'returning' visitor?");
// check if user cat is a new or returning visitor
String catVisitor = input.nextLine();
if (catVisitor.equals("new")) {
System.out.println("Hey new visitor");
System.out.println("Please allow us to collect some information about your cat:");
System.out.println("What is your Cat name?");
String newCatName = input.nextLine();
setPetName(newCatName);
System.out.println("How old is your Cat?");
int newCatAge = input.nextInt();
setPetAge(newCatAge);
System.out.println("How many days will your Cat be staying with us?");
int catDays = input.nextInt();
// set the amount of days
setDaysStay(catDays);
System.out.println("Thank you for the cat information!");
// decrease the avaialble slot of cat space by one
int currentCatSpace = getCatSpace();
setCatSpace(currentCatSpace - 1);
} else if (catVisitor.equals("returning")) {
System.out.println("It is good to see you again!");
System.out.println("Please let us update some of your cat information");
System.out.println("How many days will your Cata be staying with us?");
int catDays = input.nextInt();
// set the amount of days for returning cats
setDaysStay(catDays);
// decrease avaialble cat space
int currentCatSpace = getCatSpace();
setCatSpace(currentCatSpace - 1);
updatePet();
}
} else {
System.out.println("Sorry no room left in Cat space");
}
} else if (userChoice.equals("dog")) {
System.out.println("woof woof");
// check if dog space is available
if (getDogSpace() >= 1) {
System.out.println("Dog space availale hooray!");
System.out.println("Is your Dog a 'new' or 'returning' visitor?");
// check is user Dog is a new or returning visitor
String dogVisitor = input.nextLine();
if (dogVisitor.equals("new")) {
System.out.println("Welcome new visitor!");
System.out.println("Please allow us to collect some information about your dog:");
System.out.println("What is your dog name?");
String newDogName = input.nextLine();
setPetName(newDogName);
System.out.println("Now how old is your dog?");
int newDogAge = input.nextInt();
setPetAge(newDogAge);
System.out.println("How many days will your dog be staying with us?");
int dogDays = input.nextInt();
// check if grooming services for dogs are needed
if (dogDays >= 2){
System.out.println("Grooming services are avaialble for your dog!");
} else{
System.out.println("Grooming is not availalbe for your dog");
}
System.out.println("Thank you for the dog information!");
// decrease dog space by 1
int currentDogSpace = getDogSpace();
setDogSpace(currentDogSpace - 1);
} else if (dogVisitor.equals("returning")) {
System.out.println("It is good to see you again!");
System.out.println("Please allow us to update some of your dog information");
System.out.println("How many days will your dog be staying with us?");
int dogDays = input.nextInt();
// check if grooming for returning dogs is needed
if(dogDays >= 2){
System.out.println("Grooming services are available for your dog!");
} else{
System.out.println("Grooming is not available for your dog");
}
// decrease dog space by 1 for returning
int currentDogSpace = getDogSpace();
setDogSpace(currentDogSpace - 1);
updatePet();
}
} else {
System.out.println("Sorry no room left in Dog space");
}
} else{
System.out.println("Invalid choice, please select 'cat or 'dog'");
checkIn();
}
// checkIn();
}
// checkOut method
public void checkOut() {
checkOut();
}
// getPet method
public void getPet() {
getPet();
}
// createPet method
public void createPet() {
createPet();
}
// updatePet method
public void updatePet() {
//updatePet();
}
public String getPetType() {
return petType;
}
public void setPetType(String petType) {
this.petType = petType;
}
public String getPetName() {
return petName;
}
public void setPetName(String petName) {
this.petName = petName;
}
public int getPetAge() {
return petAge;
}
public void setPetAge(int petAge) {
this.petAge = petAge;
}
public int getDogSpace() {
return dogSpace;
}
public void setDogSpace(int dogSpace) {
this.dogSpace = dogSpace;
}
public int getCatSpace() {
return catSpace;
}
public void setCatSpace(int catSpace) {
this.catSpace = catSpace;
}
public int getDaysStay() {
return daysStay;
}
public void setDaysStay(int daysStay) {
this.daysStay = daysStay;
}
public double getAmountDue() {
return amountDue;
}
public void setAmountDue(double amountDue) {
this.amountDue = amountDue;
}
}