Готовая Лабораторная 4

This commit is contained in:
Никита Белянин 2023-11-13 00:16:29 +04:00
parent 1c95abf999
commit 729aeaaed7
4 changed files with 22 additions and 10 deletions

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" default="true" project-jdk-name="19" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_20" default="true" project-jdk-name="19" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" /> <output url="file://$PROJECT_DIR$/out" />

11
Tank/Tank.iml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -5,7 +5,7 @@ public enum CountWheels {
Five(5); Five(5);
private final int Value; private final int Value;
CountWheels(int Count){ CountWheels(int Count){
Value=Count; Value = Count;
} }
public int getCountWheels(){ public int getCountWheels(){
return Value; return Value;

View File

@ -22,7 +22,7 @@ public class DrawingArmoVehicle {
ArmoVehicle = new EntityArmoVehicle(speed, weight, bodyColor, _numWheel); ArmoVehicle = new EntityArmoVehicle(speed, weight, bodyColor, _numWheel);
Random random = new Random(); Random random = new Random();
switch (random.nextInt(0, 3)) { switch(random.nextInt(0, 3)) {
case 0: case 0:
OrnamentsForm = new DrawingWheelsCombination(); OrnamentsForm = new DrawingWheelsCombination();
break; break;
@ -54,19 +54,19 @@ public class DrawingArmoVehicle {
_startPosY = Math.min(y, _pictureHeight - _TankHeight); _startPosY = Math.min(y, _pictureHeight - _TankHeight);
} }
public int GetPosX() { public int GetPosX () {
return _startPosX; return _startPosX;
} }
public int GetPosY() { public int GetPosY () {
return _startPosY; return _startPosY;
} }
public int GetWidth() { public int GetWidth () {
return _TankWidth; return _TankWidth;
} }
public int GetHeight() { public int GetHeight () {
return _TankHeight; return _TankHeight;
} }
@ -95,19 +95,19 @@ public class DrawingArmoVehicle {
switch (direction) { switch (direction) {
//влево //влево
case Left: case Left:
_startPosX -= (int) ArmoVehicle.Step; _startPosX -= (int)ArmoVehicle.Step;
break; break;
//вверх //вверх
case Up: case Up:
_startPosY -= (int) ArmoVehicle.Step; _startPosY -= (int)ArmoVehicle.Step;
break; break;
// вправо // вправо
case Right: case Right:
_startPosX += (int) ArmoVehicle.Step; _startPosX += (int)ArmoVehicle.Step;
break; break;
//вниз //вниз
case Down: case Down:
_startPosY += (int) ArmoVehicle.Step; _startPosY += (int)ArmoVehicle.Step;
break; break;
} }
} }