[ all classes ]
[ <empty package name> ]
Coverage Summary for Class: Dog (<empty package name>)
Class | Class, % | Method, % | Line, % |
---|---|---|---|
Dog | 100% (1/ 1) | 75% (3/ 4) | 58.3% (7/ 12) |
1 /**
2 * Dog class. Represents the basics of a Dog and related methods
3 */
4 public class Dog {
5
6 //variables
7 /**
8 * name of Dog as a String
9 */
10 String name;
11
12 /**
13 * owner's name
14 */
15 String owner;
16
17 /**
18 * age as an int
19 */
20 int age;
21
22 /**
23 * breed of Dog
24 */
25 String breed;
26
27
28 /**
29 * the dogs favorite food
30 */
31 String favoriteFood;
32
33 //constructors
34
35 /**
36 * default constructor initiallizes variables to dummy values
37 */
38 Dog() {
39 name ="Fido";
40 owner = "Lynne";
41 age = 1;
42 breed = "unkown";
43 }
44
45 /**
46 * constructor that takes in initial values for following class variables
47 * @param n Dog's name
48 * @param o Dog's owner's name
49 * @param a Dog's age as an int
50 * @param b Dog's breed
51 */
52 Dog(String n, String o, int a, String b){
53 this.name = n;
54 this.owner = o;
55 this.age = a;
56 this.breed = b;
57 }
58
59
60 //methods
61 /**
62 * getter for name of Dog
63 * @return the name as a String
64 */
65 String getName(){
66 return this.name;
67 }
68
69 /**
70 * setter for name of Dog
71 * @param n name to be stored
72 */
73 void setName(String n){
74 this.name = n;
75 }
76
77 }