diff --git a/AUTOMAT.iml b/AUTOMAT.iml new file mode 100644 index 0000000..e286e56 --- /dev/null +++ b/AUTOMAT.iml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..31ec34d --- /dev/null +++ b/pom.xml @@ -0,0 +1,12 @@ + + + 4.0.0 + + AUTOMAT + AUTOMAT + 1.0-SNAPSHOT + + + \ No newline at end of file diff --git a/src/main/java/Automat.class b/src/main/java/Automat.class new file mode 100644 index 0000000..b16efc7 Binary files /dev/null and b/src/main/java/Automat.class differ diff --git a/src/main/java/Automat.java b/src/main/java/Automat.java new file mode 100644 index 0000000..1317a65 --- /dev/null +++ b/src/main/java/Automat.java @@ -0,0 +1,95 @@ + +import java.util.Random; +import java.util.Scanner; +import java.util.logging.ConsoleHandler; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class Automat { + public static void printTrays(Tray[][] trays){ + for (Tray[] i : + trays){ + for (Tray tray : + i) { + System.out.print(tray + " | "); + } + System.out.println(); + } + } + + public static float wydaj(Tray[][] trays,float money,int id){ + for (int i=0 ;i0 && money>=trays[i][j].getPrice()){ + trays[i][j].dropOne(); + return money-trays[i][j].getPrice(); + } + else { + return money; + } + } + } + } + return money; + } + public static float insert(float money, float value){ + return money+value; + } + public static boolean checkRegex(String regex , String input){ + Pattern compiledPattern = Pattern.compile(regex); + Matcher matcher = compiledPattern.matcher(input); +// System.out.println(matcher.find()); +// System.out.println(matcher.matches()); + return matcher.matches(); + } + public static void main(String[] args){ + System.out.println("AUTOMAT PZDR600"); + System.out.println("INICJALIZACJA"); + Scanner scanner = new Scanner(System.in); + String userInput=""; + Tray[][] trays=new Tray[10][5]; + float money=0; + System.out.println("ladowanie danych"); + Random random= new Random(); + int number=1; + for (int i=0 ;i0){ + this.amount--; + return true; + } + else return false; + } + + @Override public String toString(){ + String number = String.valueOf(this.number); + String amount = String.valueOf(this.amount); + String price = String.format("%.02f", this.price);; + return "id "+ number + " " + "ilosc " + amount + " " + "cena "+price; + } + +} diff --git a/target/classes/Automat.class b/target/classes/Automat.class new file mode 100644 index 0000000..83107de Binary files /dev/null and b/target/classes/Automat.class differ diff --git a/target/classes/Tray.class b/target/classes/Tray.class new file mode 100644 index 0000000..a546486 Binary files /dev/null and b/target/classes/Tray.class differ