|
1 |
| -package com.codedifferently.lesson16.Dog; |
| 1 | +import java.awt.Color; |
| 2 | +import java.util.ArrayList; |
| 3 | +import java.util.List; |
2 | 4 |
|
3 | 5 | public class Dog {
|
4 |
| - private final Enum Colors; |
5 |
| - |
6 |
| - private Enum getColors() { |
7 |
| - return Colors; |
8 |
| - } |
9 |
| - |
10 |
| - enum Colors { |
11 |
| - WHITE, |
12 |
| - BROWN, |
13 |
| - BLONDE; |
14 |
| - } |
15 |
| - |
16 |
| - { |
17 |
| - Colors[] colors = Colors.values(); |
18 |
| - for (var i = 0; i < Colors.length; i++) {} |
19 |
| - } |
20 |
| - |
21 |
| - // Attributes |
22 |
| - private int Age; |
23 |
| - private String Breed; |
24 |
| - private String Gender; |
25 |
| - private Boolean isFed, isNotFed; |
26 |
| - |
27 |
| - // Constructor |
28 |
| - public Dog(int Age, String Breed, String Gender, Enum Colors, Boolean isFed) { |
29 |
| - this.Age = Age; |
30 |
| - this.Breed = Breed; |
31 |
| - this.Gender = Gender; |
32 |
| - this.Colors = Colors; |
33 |
| - this.isFed = isFed | isNotFed; |
34 |
| - } |
35 |
| - |
36 |
| - public static int myDogsAge(int Age) { |
37 |
| - return 2; |
38 |
| - } |
39 |
| - |
40 |
| - public static String getbreed(String breed) { |
41 |
| - return "mutt"; |
42 |
| - } |
43 |
| - |
44 |
| - public static String getGender(String Gender) { |
45 |
| - return "male"; |
46 |
| - } |
47 |
| - |
48 |
| - public static Enum getColors(Enum Colors) { |
49 |
| - return Colors; |
50 |
| - } |
51 |
| - |
52 |
| - public Boolean isFed(Boolean Fed) { |
53 |
| - |
54 |
| - Boolean getFedStatus = isFed, isNotFed; |
55 |
| - |
56 |
| - return getFedStatus == Fed; |
| 6 | + public abstract class EnumToArray { |
| 7 | + enum Colors { |
| 8 | + WHITE, |
| 9 | + BROWN, |
| 10 | + BLONDE; |
| 11 | + } |
| 12 | + |
| 13 | + public static void main(Enum[] args) { |
| 14 | + |
| 15 | + List<Color> colorList = new ArrayList<>(); |
| 16 | + for (Colors color : Colors.values()) {} |
| 17 | + } |
| 18 | + |
| 19 | + // Attributes |
| 20 | + private int age; |
| 21 | + private String breed; |
| 22 | + private String gender; |
| 23 | + private Boolean isFed, isNotFed; |
| 24 | + private Colors color; |
| 25 | + |
| 26 | + // Constructor |
| 27 | + void Dog(int age, String breed, String gender, Enum Colors, boolean isFed) { |
| 28 | + this.age = age; |
| 29 | + this.breed = breed; |
| 30 | + this.gender = gender; |
| 31 | + this.color = color; |
| 32 | + this.isFed = isFed | isNotFed; |
| 33 | + } |
| 34 | + |
| 35 | + public static int myDogsAge(int Age) { |
| 36 | + return 2; |
| 37 | + } |
| 38 | + |
| 39 | + public static String getbreed(String breed) { |
| 40 | + return "mutt"; |
| 41 | + } |
| 42 | + |
| 43 | + public static String getGender(String Gender) { |
| 44 | + return "male"; |
| 45 | + } |
| 46 | + |
| 47 | + public static Enum getColors(Enum Colors) { |
| 48 | + return Colors; |
| 49 | + } |
| 50 | + |
| 51 | + public Boolean isFed(Boolean Fed) { |
| 52 | + |
| 53 | + Boolean getFedStatus = isFed, isNotFed; |
| 54 | + |
| 55 | + return getFedStatus == Fed; |
| 56 | + } |
57 | 57 | }
|
58 | 58 | }
|
0 commit comments