diff --git a/L5T1/pom.xml b/L5T1/pom.xml
new file mode 100644
index 0000000..60a3b6e
--- /dev/null
+++ b/L5T1/pom.xml
@@ -0,0 +1,28 @@
+
+
+ 4.0.0
+
+ org.example
+ L5T1
+ 1.0-SNAPSHOT
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 1.8
+ 1.8
+
+
+
+
+
+ ${project.basedir}/src/main/resources
+
+
+
+
\ No newline at end of file
diff --git a/L5T1/src/main/java/example/AutomataGUIDemo.java b/L5T1/src/main/java/example/AutomataGUIDemo.java
new file mode 100644
index 0000000..a69f5b8
--- /dev/null
+++ b/L5T1/src/main/java/example/AutomataGUIDemo.java
@@ -0,0 +1,154 @@
+package example;
+import java.util.ArrayList;
+public class AutomataGUIDemo
+{
+ enum STATES {OFF, WAIT, ACCEPT, CHECK, COOK}
+ private int cash;
+ private int change;
+ public void setMenu()
+ {
+ menu.add("Кофе");
+ menu.add("Чай");
+ menu.add("Крепкий кофе");
+ menu.add("Чай с молоком");
+ menu.add("Холодный чай");
+ menu.add("Кофе с лимоном");
+ menu.add("Вода");
+ }
+ public void setPrices()
+ {
+ prices.add(25);
+ prices.add(25);
+ prices.add(30);
+ prices.add(40);
+ prices.add(20);
+ prices.add(40);
+ prices.add(10);
+ }
+ private ArrayList menu = new ArrayList<>();
+ private ArrayList prices = new ArrayList<>();
+ private STATES state;
+ private String message;
+ public AutomataGUIDemo()
+ {
+ cash = 0;
+ state = STATES.OFF;
+ }
+ public ArrayList getMenu()
+ {
+ return menu;
+ }
+ public ArrayList getPrices()
+ {
+ return prices;
+ }
+ public int getCash()
+ {
+ return cash;
+ }
+ public int getChange()
+ {
+ return change;
+ }
+ public STATES getState()
+ {
+ return state;
+ }
+ public String getMessage()
+ {
+ return message;
+ }
+ public void on()
+ {
+ if(state.equals(STATES.OFF))
+ {
+ message="Внесите нужную сумму!";
+ state = STATES.WAIT;
+ }
+ else
+ message="Ошибка!";
+ }
+ public void coin(int value)
+ {
+ if(state.equals(STATES.WAIT))
+ {
+ change=0;
+ cash+=value;
+ state=STATES.ACCEPT;
+ message="Выберите напиток!";
+ }
+ else if(state.equals(STATES.ACCEPT))
+ {
+ cash+=value;
+ }
+ else
+ message="Ошибка!";
+ }
+ public int choice(int numberOfButton)
+ {
+ int price=0;
+ if(state.equals(STATES.ACCEPT))
+ {
+ price = prices.get(numberOfButton);
+ state = STATES.CHECK;
+ }
+ else
+ message="Ошибка!";
+ return price;
+ }
+ public boolean check(int price)
+ {
+ boolean check = false;
+ if(state.equals(STATES.CHECK))
+ {
+ if (cash cbCash;
+ @FXML
+ private ProgressIndicator piProgress;
+ @FXML
+ private ImageView ivCup;
+ List menu;
+ List price;
+ AutomataGUIDemo automata;
+ @Override
+ public void initialize(URL url, ResourceBundle resourceBundle)
+ {
+ automata = new AutomataGUIDemo();
+ automata.setMenu();
+ automata.setPrices();
+ menu = automata.getMenu();
+ price = automata.getPrices();
+ setComboBox();
+ setLblNames();
+ setlblPrices();
+ ivCup.setVisible(false);
+ }
+ public void setLblNames()
+ {
+ String nameLeft1 = menu.get(0);
+ lblNameLeft1.setText(nameLeft1);
+ String nameLeft2 = menu.get(1);
+ lblNameLeft2.setText(nameLeft2);
+ String nameLeft3 = menu.get(2);
+ lblNameLeft3.setText(nameLeft3);
+ String nameLeft4 = menu.get(3);
+ lblNameLeft4.setText(nameLeft4);
+ String nameLeft5 = menu.get(4);
+ lblNameLeft5.setText(nameLeft5);
+ String nameLeft6 = menu.get(5);
+ lblNameLeft6.setText(nameLeft6);
+ }
+ public void setlblPrices()
+ {
+ String priceLeft1 = price.get(0).toString();
+ lblPriceLeft1.setText(priceLeft1);
+ String priceLeft2 = price.get(1).toString();
+ lblPriceLeft2.setText(priceLeft2);
+ String priceLeft3 = price.get(2).toString();
+ lblPriceLeft3.setText(priceLeft3);
+ String priceLeft4 = price.get(3).toString();
+ lblPriceLeft4.setText(priceLeft4);
+ String priceLeft5 = price.get(4).toString();
+ lblPriceLeft5.setText(priceLeft5);
+ String priceLeft6 = price.get(5).toString();
+ lblPriceLeft6.setText(priceLeft6);
+ String priceRight1 = price.get(6).toString();
+ lblPriceRight1.setText(priceRight1);
+ }
+ public void switchOn()
+ {
+ automata.on();
+ lblMessage.setText(automata.getMessage());
+ }
+ public void switchOff()
+ {
+ automata.off();
+ lblMessage.setText(automata.getMessage());
+ piProgress.setProgress(0);
+ }
+ public void setComboBox()
+ {
+ ObservableList cashAvailable = FXCollections.observableArrayList(5,10,50,100);
+ cbCash.setItems(cashAvailable);
+ }
+ public void getCash()
+ {
+ try
+ {
+ int cash = cbCash.getValue();
+ automata.coin(cash);
+ lblMessage.setText(automata.getMessage());
+ }
+ catch (java.lang.NullPointerException ignored){};
+ }
+ public void btnLeft1Pressed()
+ {
+ choiceAndCook(0);
+ }
+ public void btnLeft2Pressed()
+ {
+ choiceAndCook(1);
+ }
+ public void btnLeft3Pressed()
+ {
+ choiceAndCook(2);
+ }
+ public void btnLeft4Pressed()
+ {
+ choiceAndCook(3);
+ }
+ public void btnLeft5Pressed()
+ {
+ choiceAndCook(4);
+ }
+ public void btnLeft6Pressed()
+ {
+ choiceAndCook(5);
+ }
+ public void btnRight1Pressed()
+ {
+ choiceAndCook(6);
+ }
+ public void choiceAndCook (int number)
+ {
+ int price = automata.choice(number);
+ lblMessage.setText(automata.getMessage());
+ boolean check = automata.check(price);
+ if(check)
+ {
+ int change = automata.getChange();
+ try {
+ cbCash.setValue(null);
+ }
+ catch (java.lang.NullPointerException ignored){};
+ lblChange.setText(Integer.toString(change));
+ new Thread(() ->
+ {
+ cook(number, piProgress, lblMessage, ivCup);
+ }
+ ).start();
+ }
+ else
+ lblMessage.setText("Недостаточно средств!");
+ }
+ public void cook(int number, ProgressIndicator piProgress, Label lblMessage, ImageView ivCup){
+ automata.cook();
+ try
+ {
+ for(int i=0; i<=100; i++)
+ {
+ Thread.sleep(50);
+ double progress=(double)i/100;
+ Platform.runLater(() ->
+ {
+ piProgress.setProgress(progress);
+ if (piProgress.getProgress()<1)
+ lblMessage.setText(menu.get(number) + " готовится");
+ else
+ {
+ lblMessage.setText(menu.get(number) + " готов!");
+ ivCup.setVisible(true);
+ }
+ });
+ }
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ public void cancel()
+ {
+ automata.cancel();
+ int change = automata.getChange();
+ lblChange.setText(Integer.toString(change));
+ try
+ {
+ cbCash.setValue(null);
+ }
+ catch (java.lang.NullPointerException ignored){};
+ lblMessage.setText(automata.getMessage());
+ }
+}
\ No newline at end of file
diff --git a/L5T1/src/main/java/example/Main.java b/L5T1/src/main/java/example/Main.java
new file mode 100644
index 0000000..23c9d4a
--- /dev/null
+++ b/L5T1/src/main/java/example/Main.java
@@ -0,0 +1,21 @@
+package example;
+import javafx.application.Application;
+import javafx.fxml.FXMLLoader;
+import javafx.scene.Parent;
+import javafx.scene.Scene;
+import javafx.stage.Stage;
+public class Main extends Application
+{
+ @Override
+ public void start(Stage primaryStage) throws Exception
+ {
+ Parent root = FXMLLoader.load(getClass().getResource("/example.fxml"));
+ primaryStage.setTitle("Automata");
+ primaryStage.setScene(new Scene(root));
+ primaryStage.show();
+ }
+ public static void main(String[] args)
+ {
+ launch(args);
+ }
+}
\ No newline at end of file
diff --git a/L5T1/src/main/resources/Automata.png b/L5T1/src/main/resources/Automata.png
new file mode 100644
index 0000000..a74cfbf
Binary files /dev/null and b/L5T1/src/main/resources/Automata.png differ
diff --git a/L5T1/src/main/resources/cup.png b/L5T1/src/main/resources/cup.png
new file mode 100644
index 0000000..877d5d7
Binary files /dev/null and b/L5T1/src/main/resources/cup.png differ
diff --git a/L5T1/src/main/resources/example.fxml b/L5T1/src/main/resources/example.fxml
new file mode 100644
index 0000000..df83885
--- /dev/null
+++ b/L5T1/src/main/resources/example.fxml
@@ -0,0 +1,110 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/L5T2/pom.xml b/L5T2/pom.xml
new file mode 100644
index 0000000..49b6f1c
--- /dev/null
+++ b/L5T2/pom.xml
@@ -0,0 +1,12 @@
+
+
+ 4.0.0
+
+ org.example
+ L5T2
+ 1.0-SNAPSHOT
+
+
+
\ No newline at end of file
diff --git a/L5T2/src/main/java/Clock.java b/L5T2/src/main/java/Clock.java
new file mode 100644
index 0000000..886b3c8
--- /dev/null
+++ b/L5T2/src/main/java/Clock.java
@@ -0,0 +1,118 @@
+import javafx.animation.*;
+import javafx.application.Application;
+import javafx.scene.Group;
+import javafx.scene.Scene;
+import javafx.scene.image.Image;
+import javafx.scene.image.ImageView;
+import javafx.scene.paint.Color;
+import javafx.scene.shape.Circle;
+import javafx.scene.shape.Line;
+import javafx.scene.transform.Rotate;
+import javafx.stage.Stage;
+import javafx.util.Duration;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.net.URL;
+public class Clock extends Application
+{
+ public static void main(String[] args)
+ {
+ Application.launch(args);
+ }
+ @Override
+ public void start(Stage stage)
+ {
+ stage.setTitle("Clock");
+ URL background = getClass().getResource("Clock.jpg");
+ Image im = new Image(background.toString(), 600, 600, false, false);
+ ImageView ivBack = new ImageView(im);
+ Calendar myCalendar = new GregorianCalendar();
+ double secDegree = myCalendar.get(Calendar.SECOND) * (6);
+ double minDegree = (myCalendar.get(Calendar.MINUTE) + secDegree / 360.0) * (6);
+ double hourDegree = (myCalendar.get(Calendar.HOUR) + minDegree / 360) * (30);
+ Line hour, min, sec;
+ hour = new Line(0, 0, 0, -150);
+ hour.setStroke(Color.BLACK);
+ hour.setStrokeWidth(10);
+ hour.setTranslateX(300);
+ hour.setTranslateY(330);
+ Rotate rotateHour = new Rotate();
+ rotateHour.setAngle(hourDegree);
+ rotateHour.setPivotX(0);
+ rotateHour.setPivotY(-30);
+ hour.getTransforms().addAll(rotateHour);
+ min = new Line(0, 0, -0, -180);
+ min.setStroke(Color.BLACK);
+ min.setStrokeWidth(5);
+ min.setTranslateX(300);
+ min.setTranslateY(330);
+ Rotate rotateMin = new Rotate();
+ rotateMin.setAngle(minDegree);
+ rotateMin.setPivotX(0);
+ rotateMin.setPivotY(-30);
+ min.getTransforms().addAll(rotateMin);
+ sec = new Line(0, 0, -0, -210);
+ sec.setStroke(Color.BLACK);
+ sec.setStrokeWidth(3);
+ sec.setTranslateX(300);
+ sec.setTranslateY(330);
+ Rotate rotateSec = new Rotate();
+ rotateSec.setAngle(secDegree);
+ rotateSec.setPivotX(0);
+ rotateSec.setPivotY(-30);
+ sec.getTransforms().addAll(rotateSec);
+ Circle circle = new Circle();
+ circle.setCenterX(300);
+ circle.setCenterY(300);
+ circle.setRadius(10);
+ final Timeline secTimeline = new Timeline
+ (
+ new KeyFrame
+ (
+ Duration.seconds(60),
+ new KeyValue
+ (
+ rotateSec.angleProperty(),
+ 360 + secDegree,
+ Interpolator.LINEAR
+ )
+ )
+ );
+ final Timeline minTimeline = new Timeline
+ (
+ new KeyFrame
+ (
+ Duration.minutes(60),
+ new KeyValue
+ (
+ rotateMin.angleProperty(),
+ 360 + minDegree,
+ Interpolator.LINEAR
+ )
+ )
+ );
+ final Timeline hourTimeline = new Timeline
+ (
+ new KeyFrame
+ (
+ Duration.hours(12),
+ new KeyValue
+ (
+ rotateHour.angleProperty(),
+ 360 + hourDegree,
+ Interpolator.LINEAR
+ )
+ )
+ );
+ secTimeline.setCycleCount(Animation.INDEFINITE);
+ minTimeline.setCycleCount(Animation.INDEFINITE);
+ hourTimeline.setCycleCount(Animation.INDEFINITE);
+ secTimeline.play();
+ minTimeline.play();
+ hourTimeline.play();
+ Group root = new Group(ivBack, sec, min, hour, circle);
+ Scene scene = new Scene(root, 600, 600);
+ stage.setScene(scene);
+ stage.show();
+ }
+}
\ No newline at end of file
diff --git a/L5T2/src/main/resources/Clock.jpg b/L5T2/src/main/resources/Clock.jpg
new file mode 100644
index 0000000..6f174e2
Binary files /dev/null and b/L5T2/src/main/resources/Clock.jpg differ