|
@@ -14,6 +14,7 @@ public class UserInput {
|
14
|
14
|
public void setNumOfPets() {
|
15
|
15
|
|
16
|
16
|
System.out.println("How many pets do you have?");
|
|
17
|
+
|
17
|
18
|
this.numOfPets = scanner.nextInt();
|
18
|
19
|
}
|
19
|
20
|
|
|
@@ -30,16 +31,19 @@ public class UserInput {
|
30
|
31
|
listOfPets = new ArrayList<Pet>();
|
31
|
32
|
|
32
|
33
|
for (int i = 1; i <= numOfPets; i++) {
|
|
34
|
+
|
33
|
35
|
System.out.println("What kind of pet is it?");
|
34
|
36
|
String petType = scanner.next();
|
35
|
37
|
|
36
|
38
|
if (petType.toLowerCase().equals("dog")) {
|
|
39
|
+
|
37
|
40
|
pet = new Dog();
|
38
|
41
|
|
39
|
42
|
System.out.println("what is it's name?");
|
40
|
43
|
pet.setNameOfPet(scanner.next());
|
41
|
44
|
listOfPets.add(pet);
|
42
|
45
|
} else if(petType.toLowerCase().equals("cat")) {
|
|
46
|
+
|
43
|
47
|
pet = new Cat();
|
44
|
48
|
|
45
|
49
|
System.out.println("what is it's name?");
|
|
@@ -47,21 +51,19 @@ public class UserInput {
|
47
|
51
|
listOfPets.add(pet);
|
48
|
52
|
|
49
|
53
|
} else if (petType.toLowerCase().equals("lion")) {
|
|
54
|
+
|
50
|
55
|
pet = new Lion();
|
|
56
|
+
|
51
|
57
|
System.out.println("what is it's name?");
|
52
|
58
|
pet.setNameOfPet(scanner.next());
|
53
|
59
|
listOfPets.add(pet);
|
54
|
60
|
}
|
55
|
61
|
}
|
56
|
62
|
}
|
|
63
|
+ public List<Pet> getListOfPets () {
|
57
|
64
|
|
58
|
|
-// public Pet petMaker (String petName){
|
59
|
|
-//
|
60
|
|
-// return null;
|
61
|
|
-// }
|
|
65
|
+ return listOfPets;
|
62
|
66
|
|
63
|
|
- public List<Pet> getListOfPets () {
|
64
|
|
- return listOfPets;
|
65
|
67
|
}
|
66
|
68
|
|
67
|
69
|
}
|