Skip to content

Commit 55f43f1

Browse files
committed
...-14
1 parent b7e2c32 commit 55f43f1

25 files changed

+980
-22
lines changed

.idea/libraries/javafx_sdk_15.xml

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

java2020.iml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
</content>
88
<orderEntry type="inheritedJdk" />
99
<orderEntry type="sourceFolder" forTests="false" />
10+
<orderEntry type="library" name="javafx-sdk-15" level="project" />
1011
</component>
11-
</module>
12-
12+
</module>
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package ru.shureck.java2020.Hack;
2+
3+
public class Client {
4+
private float lat, lon;
5+
6+
public Client(float lat, float lon) {
7+
this.lat = lat;
8+
this.lon = lon;
9+
}
10+
11+
public void setLocation(float lat, float lon){
12+
this.lat = lat;
13+
this.lon = lon;
14+
}
15+
16+
public float getLat() {
17+
return lat;
18+
}
19+
20+
public void setLat(float lat) {
21+
this.lat = lat;
22+
}
23+
24+
public float getLon() {
25+
return lon;
26+
}
27+
28+
public void setLon(float lon) {
29+
this.lon = lon;
30+
}
31+
}
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package ru.shureck.java2020.Hack;
2+
3+
public class Courier {
4+
private float lat, lon;
5+
private int transport; // 0 - walking; 1 - bacikling; 2 - driving
6+
private int rating;
7+
8+
public Courier(float lat, float lon, int transport, int rating) {
9+
this.lat = lat;
10+
this.lon = lon;
11+
this.transport = transport;
12+
this.rating = rating;
13+
}
14+
15+
public Courier(int transport, int rating) {
16+
this.transport = transport;
17+
this.rating = rating;
18+
}
19+
20+
public void setLocation(float lat, float lon){
21+
this.lat = lat;
22+
this.lon = lon;
23+
}
24+
25+
public float getLat() {
26+
return lat;
27+
}
28+
29+
public void setLat(float lat) {
30+
this.lat = lat;
31+
}
32+
33+
public float getLon() {
34+
return lon;
35+
}
36+
37+
public void setLon(float lon) {
38+
this.lon = lon;
39+
}
40+
41+
public int getTransport() {
42+
return transport;
43+
}
44+
45+
public void setTransport(int transport) {
46+
this.transport = transport;
47+
}
48+
49+
public int getRating() {
50+
return rating;
51+
}
52+
53+
public void setRating(int rating) {
54+
this.rating = rating;
55+
}
56+
}
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package ru.shureck.java2020.Hack;
2+
3+
public class Goods {
4+
private float lat, lon;
5+
6+
public Goods(float lat, float lon) {
7+
this.lat = lat;
8+
this.lon = lon;
9+
}
10+
11+
public void setLocation(float lat, float lon){
12+
this.lat = lat;
13+
this.lon = lon;
14+
}
15+
16+
public float getLat() {
17+
return lat;
18+
}
19+
20+
public void setLat(float lat) {
21+
this.lat = lat;
22+
}
23+
24+
public float getLon() {
25+
return lon;
26+
}
27+
28+
public void setLon(float lon) {
29+
this.lon = lon;
30+
}
31+
}
+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
package ru.shureck.java2020.Lab10;
2+
3+
import java.util.ArrayList;
4+
5+
public class Lab10 {
6+
7+
public static void main(String[] args) {
8+
ex1(2,15);
9+
System.out.println(ex2(2,5));
10+
ex3(568793);
11+
}
12+
13+
14+
static void ex1(int k, int s){
15+
ArrayList<Integer> arr = new ArrayList<>();
16+
int counter = 0;
17+
arr.add(0);
18+
for(int i=0; i<k-1; i++){
19+
arr.add(0);
20+
}
21+
while(arrSum(arr) != 9*k) {
22+
arr.set(0, (arr.get(0) + 1) % 10);
23+
for(int w=1; w<k-1; w++){
24+
arr.set(w,0);
25+
}
26+
for (int i = k-1; i > 0; i--) {
27+
for (int j = 0; j < 10; j++) {
28+
if(arrSum(arr) == 9*k){
29+
//System.out.println(arr +" " +(arrSum(arr)));
30+
counter++;
31+
break;
32+
}
33+
//System.out.println(arr +" " +(arrSum(arr)));
34+
if ((arrSum(arr) == s) && (arr.get(0) != 0)) {
35+
counter++;
36+
}
37+
arr.set(i, (arr.get(i) + 1) % 10);
38+
}
39+
}
40+
}
41+
System.out.println(counter);
42+
}
43+
44+
static int arrSum(ArrayList<Integer> arrayList){
45+
int sum=0;
46+
for (int i = 0; i < arrayList.size(); i++) {
47+
sum += arrayList.get(i);
48+
}
49+
return sum;
50+
}
51+
52+
static int ex2(int a, int b){
53+
if (a >= b+2) {
54+
return 0;
55+
}
56+
57+
if (a == 0 || b == 0) {
58+
return 1;
59+
}
60+
61+
return ex2(a, b-1) + ex2(a-1, b-1);
62+
}
63+
64+
static void ex3(int n){
65+
if(n/10>0) {
66+
ex3(n/10);
67+
System.out.print(" "+n % 10);
68+
}
69+
else{
70+
System.out.print(n);
71+
}
72+
}
73+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
package ru.shureck.java2020.Lab11;
2+
3+
import javafx.application.Application;
4+
import javafx.application.Platform;
5+
import javafx.event.ActionEvent;
6+
import javafx.event.EventHandler;
7+
import javafx.fxml.FXML;
8+
import javafx.scene.Scene;
9+
import javafx.scene.control.Button;
10+
import javafx.scene.control.Label;
11+
import javafx.scene.control.TextField;
12+
import javafx.scene.layout.StackPane;
13+
import javafx.scene.text.Text;
14+
import javafx.stage.Stage;
15+
import javafx.stage.WindowEvent;
16+
17+
import java.util.Random;
18+
19+
public class Controller{
20+
21+
@FXML
22+
Text text1;
23+
@FXML
24+
TextField text2;
25+
@FXML
26+
Button ewe;
27+
28+
public void initialize() {
29+
text1.setText("Введите число");
30+
Random random = new Random();
31+
int s = random.nextInt(20);
32+
ewe.setOnAction(new EventHandler<ActionEvent>() {
33+
@Override
34+
public void handle(ActionEvent actionEvent) {
35+
int k=0;
36+
try {
37+
k = Integer.parseInt(text2.getText());
38+
if(k<s){
39+
text1.setText("Больше");
40+
text2.setText("");
41+
}
42+
if(k>s){
43+
text1.setText("Меньше");
44+
text2.setText("");
45+
}
46+
if(k==s){
47+
Label secondLabel = new Label("Вы угадали");
48+
Lab11 lab11 = new Lab11();
49+
StackPane secondaryLayout = new StackPane();
50+
secondaryLayout.getChildren().add(secondLabel);
51+
Scene secondScene = new Scene(secondaryLayout, 230, 100);
52+
text1.setText("Ура!");
53+
Stage newWindow = new Stage();
54+
newWindow.setTitle("Ура!");
55+
newWindow.setScene(secondScene);
56+
newWindow.setOnCloseRequest(new EventHandler<WindowEvent>() {
57+
@Override
58+
public void handle(WindowEvent windowEvent) {
59+
newWindow.close();
60+
lab11.close();
61+
}
62+
});
63+
newWindow.show();
64+
}
65+
} catch (NumberFormatException e) {
66+
text1.setText("Введено не число");
67+
text2.setText("");
68+
}
69+
70+
}
71+
});
72+
73+
74+
}
75+
}
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package ru.shureck.java2020.Lab11;
2+
3+
import javafx.application.Application;
4+
import javafx.application.Platform;
5+
import javafx.fxml.FXML;
6+
import javafx.fxml.FXMLLoader;
7+
import javafx.scene.Parent;
8+
import javafx.scene.Scene;
9+
import javafx.stage.Stage;
10+
11+
import java.awt.*;
12+
13+
public class Lab11 extends Application{
14+
15+
public Stage ss;
16+
17+
@Override
18+
public void start(Stage stage) throws Exception {
19+
Parent root = FXMLLoader.load(getClass().getResource("hellofx.fxml"));
20+
ss = stage;
21+
stage.setTitle("Hello World");
22+
stage.setScene(new Scene(root));
23+
stage.show();
24+
}
25+
26+
public static void main(String[] args) {
27+
launch(args);
28+
}
29+
30+
public void close(){
31+
Platform.exit();
32+
}
33+
}
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.scene.control.*?>
4+
<?import javafx.scene.layout.*?>
5+
<?import javafx.scene.text.*?>
6+
7+
<VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ru.shureck.java2020.Lab11.Controller">
8+
<children>
9+
<Text id="text1" fx:id="text1" smooth="false" text="Kek" textAlignment="CENTER">
10+
<font>
11+
<Font size="15.0" />
12+
</font>
13+
</Text>
14+
<TextField fx:id="text2" />
15+
<Button fx:id="ewe" mnemonicParsing="false" text="Button" />
16+
17+
</children>
18+
</VBox>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package ru.shureck.java2020.Lab12;
2+
3+
import javafx.application.Platform;
4+
import javafx.collections.FXCollections;
5+
import javafx.collections.ObservableList;
6+
import javafx.event.ActionEvent;
7+
import javafx.event.EventHandler;
8+
import javafx.fxml.FXML;
9+
import javafx.scene.control.*;
10+
import javafx.scene.input.ContextMenuEvent;
11+
import javafx.scene.text.Text;
12+
13+
import java.util.Random;
14+
15+
public class Controller {
16+
17+
@FXML
18+
Text text1;
19+
@FXML
20+
ComboBox<Planet> splitBtn;
21+
22+
23+
public void initialize() {
24+
text1.setText("Выберите планету");
25+
ObservableList<Planet> list = FXCollections.observableArrayList(Planet.MERCURY, Planet.VENUS, Planet.EARTH, Planet.MARS, Planet.JUPITER, Planet.SATURN, Planet.URANUS, Planet.NEPTUNE);
26+
splitBtn.setItems(list);
27+
splitBtn.setPromptText("Планеты");
28+
splitBtn.valueProperty().addListener((obs, oldItem, newItem) -> {
29+
if (newItem == null) {
30+
System.out.println("");
31+
} else {
32+
text1.setText(String.valueOf(obs.getValue().surfaceGravity()));
33+
}
34+
});
35+
}
36+
37+
}

0 commit comments

Comments
 (0)