-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mohamed
committed
Mar 14, 2024
1 parent
b48d11e
commit 14e49db
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
...jects/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/Part.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
} | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
...s/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/cpuBrand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.codedifferently.lesson7.mohamedobjects.main; | ||
|
||
public enum cpuBrand { | ||
AMD, | ||
INTEL, | ||
APPLE | ||
} |
8 changes: 8 additions & 0 deletions
8
...s/objects_app/src/main/java/com/codedifferently/lesson7/MohamedObjects/Main/portType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.codedifferently.lesson7.mohamedobjects.main; | ||
|
||
public enum portType { | ||
VGA, | ||
DVI, | ||
HDMI, | ||
DP | ||
} |