Skip to content

Commit ce1d4b7

Browse files
committed
Feat: Adds Nile Jackson's .java files for lesson16
1 parent a3a21bb commit ce1d4b7

File tree

2 files changed

+136
-0
lines changed
  • lesson_16/objects/objects_app/src
    • main/java/com/codedifferently/lesson16/Nile'sDog16
    • test/java/com/codedifferently/lesson16/Nile'sDogTest16

2 files changed

+136
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package com.codedifferently.lesson16.Dog;
2+
3+
4+
5+
public class Dog {
6+
private final Enum Colors;
7+
8+
private Enum getColors() {
9+
return Colors;
10+
}
11+
enum Colors{
12+
WHITE,
13+
BROWN,
14+
BLONDE;
15+
}
16+
{
17+
Colors[] colors = Colors.values();
18+
for (var i = 0; i < Colors.length;i ++) {
19+
20+
}
21+
22+
}
23+
24+
25+
26+
27+
//Attributes
28+
private int Age;
29+
private String Breed;
30+
private String Gender;
31+
private Boolean isFed, isNotFed;
32+
33+
//Constructor
34+
public Dog(int Age, String Breed, String Gender, Enum Colors, Boolean isFed) {
35+
this.Age = Age;
36+
this.Breed = Breed;
37+
this.Gender = Gender;
38+
this.Colors = Colors;
39+
this.isFed = isFed | isNotFed;
40+
}
41+
public static int myDogsAge(int Age) {
42+
return 2;
43+
}
44+
public static String getbreed(String breed) {
45+
return "mutt";
46+
}
47+
public static String getGender(String Gender) {
48+
return "male";
49+
}
50+
public static Enum getColors(Enum Colors) {
51+
return Colors;
52+
}
53+
public Boolean isFed(Boolean Fed) {
54+
55+
Boolean getFedStatus = isFed, isNotFed;
56+
57+
return getFedStatus == Fed;
58+
}
59+
60+
}
61+
62+
63+
64+
65+
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import static org.assertj.core.api.Assertions.assertThat;
2+
import org.junit.jupiter.api.Test;
3+
4+
5+
6+
public class DogTest {
7+
8+
9+
public int getAge(int Age) {
10+
return Age;
11+
}
12+
@Test
13+
public void testGetAge() {
14+
int getAge = getAge(2);
15+
int myDogsAge = getAge(2);
16+
assertThat(getAge(2)).isNotNull();
17+
18+
}
19+
public String getbreed(String breed) {
20+
return breed;
21+
}
22+
@Test
23+
public void testGetBreed() {
24+
String getBreed = getbreed(getbreed("Mutt"));
25+
assertThat(getbreed("mutt"));
26+
27+
}
28+
public String getGender(String gender) {
29+
return gender;
30+
}
31+
32+
@Test
33+
public String testGetGender() {
34+
String getGender = getGender(getGender("male"));
35+
String myDogsGender = testGetGender();
36+
assertThat(getGender("male"));
37+
return testGetGender();
38+
}
39+
public Enum getColors(Enum Colors) {
40+
return Colors;
41+
}
42+
@Test
43+
private final Enum testGetColors(Enum Colors) {
44+
Enum testGetColors = Colors;
45+
return Colors;
46+
}
47+
48+
@Test
49+
public void testgetColor() {
50+
assertThat(getColors(null));
51+
}
52+
@Test
53+
Boolean isFed(Boolean Fed) {
54+
var isNotFed = false;
55+
var isFed = true;
56+
var getFedStatus = Fed | isNotFed;
57+
assertThat(getFedStatus).isTrue();
58+
assertThat(Fed).isFalse();
59+
return getFedStatus == Fed;
60+
}
61+
62+
}
63+
64+
65+
66+
67+
68+
69+
70+
71+

0 commit comments

Comments
 (0)