Финал

This commit is contained in:
DyCTaTOR 2023-12-05 17:24:43 +04:00
parent 41bc1ec037
commit 8737449c24
2 changed files with 12 additions and 8 deletions

View File

@ -6,16 +6,11 @@ public enum CountWheels{
private CountWheels(int val){
this.val = val;
}
private int countWheels;
public int getCountWheels(){
return val;
}
public void setCountWheels(int countWheels){
this.countWheels = countWheels;
}
public void setEnumValue(){
CountWheels enumvalue = CountWheels.values()[countWheels];
}
public static CountWheels fromNumberToEnum(int number) {
try{
for (CountWheels countWheels : CountWheels.values()) {

View File

@ -7,12 +7,21 @@ public class DrawingWheels{
Color color;
private CountWheels _countWheels;
public void setNumWheels(int numRollers) {
if (numRollers < 4 || numRollers > 6 ){
_countWheels = CountWheels.fromNumberToEnum(numRollers);
return;
}
_countWheels = CountWheels.fromNumberToEnum(numRollers);
}
public DrawingWheels(Graphics g, int startPosX, int startPosY, Color color, int countWheels){
this.g = g;
_startPosX = startPosX;
_startPosY = startPosY;
this.color = color;
_countWheels.setCountWheels(countWheels);
setNumWheels(countWheels);
}
public void Draw(){
switch(_countWheels){