diff --git a/lesson_07/objects/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/Part.java b/lesson_07/objects/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/Part.java new file mode 100644 index 00000000..52df260f --- /dev/null +++ b/lesson_07/objects/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/Part.java @@ -0,0 +1,49 @@ +package com.codedifferently.lesson7.mohamedobjects.main; + +public class Part { + String name; + int releaseYear; + String brand; + + public Part() {} + + public Part(String name, int releaseYear, String brand) { + this.name = name; + checkValidYear(releaseYear); + this.releaseYear = releaseYear; + this.brand = brand; + } + + public void setBrand(String brand) { + this.brand = brand; + } + + public void setName(String name) { + this.name = name; + } + + public void setReleaseYear(int releaseYear) { + checkValidYear(releaseYear); + this.releaseYear = releaseYear; + } + + public String getBrand() { + return brand; + } + + public String getName() { + return name; + } + + public int getReleaseYear() { + return releaseYear; + } + + public boolean checkValidYear(int year) { + if (year <= 2024 && year >= 2000) { + return true; + } else { + throw new IllegalYearExeption("Year is out of expected range. 2000 - 2024"); + } + } +} diff --git a/lesson_07/objects/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/cpuBrand.java b/lesson_07/objects/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/cpuBrand.java new file mode 100644 index 00000000..79233ab0 --- /dev/null +++ b/lesson_07/objects/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/cpuBrand.java @@ -0,0 +1,7 @@ +package com.codedifferently.lesson7.mohamedobjects.main; + +public enum cpuBrand { + AMD, + INTEL, + APPLE +} diff --git a/lesson_07/objects/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/portType.java b/lesson_07/objects/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/portType.java new file mode 100644 index 00000000..07af06d2 --- /dev/null +++ b/lesson_07/objects/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/portType.java @@ -0,0 +1,8 @@ +package com.codedifferently.lesson7.mohamedobjects.main; + +public enum portType { + VGA, + DVI, + HDMI, + DP +}