From c46c7dd42ece982283359ccb692db6359082f0f8 Mon Sep 17 00:00:00 2001 From: pafcioo123 Date: Wed, 28 Oct 2020 09:14:45 +0100 Subject: [PATCH] Upload --- AUTOMAT.iml | 2 + pom.xml | 12 +++++ src/main/java/Automat.class | Bin 0 -> 1153 bytes src/main/java/Automat.java | 95 +++++++++++++++++++++++++++++++++++ src/main/java/Tray.class | Bin 0 -> 751 bytes src/main/java/Tray.java | 45 +++++++++++++++++ target/classes/Automat.class | Bin 0 -> 3778 bytes target/classes/Tray.class | Bin 0 -> 1544 bytes 8 files changed, 154 insertions(+) create mode 100644 AUTOMAT.iml create mode 100644 pom.xml create mode 100644 src/main/java/Automat.class create mode 100644 src/main/java/Automat.java create mode 100644 src/main/java/Tray.class create mode 100644 src/main/java/Tray.java create mode 100644 target/classes/Automat.class create mode 100644 target/classes/Tray.class 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 0000000000000000000000000000000000000000..b16efc79b4b0a1f396070be2121ebccf03b34e4e GIT binary patch literal 1153 zcmZuw&r{Pt6#kZ^-84zH7NbV|0V-NREmo;o5U3zhER>;DN2-U=1`M_dLaK7}z{QhZ zJbKY_Jm^IaWkzPWI9~jVJc(}u9CYY(_WjuJef#!%n_qvvZvwcADHVs&8NpecQ;<;6 zg>D5s9Oo5W;JBzlK_^F2g^ErQ^a}5i@KW;dOHiQVvRJMt=u?mu3|GZ+jpI5;h9NxQ zxQ;)_ASJr)F~}oc)n?eAcU*g_QJ=GyOV(VCGV0Q@(|uQgU4qXUQNnTnqTCWc4rQHqX}Wn@F$ z>tJ8WVQ8Z@93&+~a4dibs2S`M;(r(?*a@7Z5`wWubb?OMFW=A-mzt1;4Utu1>Q97Q z@*?IGZ$Nplj>x1m*prb>c{3f7(qSWPgx=$!DI4KbhMPR2n9624BBfPBH6rgZU@C^1 z%4i!ZurgnTyVoe-aQ`x7jA8TP+KZwKQJ59AV zaggFB3~{5D;NlaAlOLh4Q$-9KDW#(wQ6#Vr-IN)j{YPlUJPzV147?;=Us3Kg?Y$+5 z-jN0$iRm-R)=o?X$XnM-Jv~dej`L8pAMQm^B3K_ B+nN9X literal 0 HcmV?d00001 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 ;iEPKs;Oz=<$< zqAyq~vy<6mg_4Yu{I|+1n3I(ch*yPW8B?k#uck1~_#b^kVh}?OLOIMt=mrw}QKpiA zM`9#vscMEEZIZK?8zZf~#H6!?=Eu6w<1Xa&vi}isfttB9LnS;();OAK9D~hyNqLBJT((kGQ*M0%z CLtcUa literal 0 HcmV?d00001 diff --git a/src/main/java/Tray.java b/src/main/java/Tray.java new file mode 100644 index 0000000..cd9a406 --- /dev/null +++ b/src/main/java/Tray.java @@ -0,0 +1,45 @@ +public class Tray { + public int amount; + public float price; + public int number; + + public int getAmount() { + return amount; + } + + public void setAmount(int amount) { + this.amount = amount; + } + + public float getPrice() { + return price; + } + + public int getNumber() { + return number; + } + + public void setNumber(int number) { + this.number = number; + } + + public void setPrice(float price) { + this.price = price; + } + + public boolean dropOne(){ + if (this.amount>0){ + 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 0000000000000000000000000000000000000000..83107dea0707819eb4afeabc3d1965ecf583ce1d GIT binary patch literal 3778 zcmaJ^X?qjb6@ITg(v0K*jEpb>OhhQ)1!H2sapV9oi^1S6w%N>*jHST{OCv=KV45^t z+|o6r3u!~rG^J_iLTLhxa6{{^=|Z}uO}BjM)Bb=y`Ia^`?t5oO*wi$B>^t|KbMD#C zJLBtbzcc}09bONh6&XJsLRLjCfHGv{lGjj>&*O4A5x_}|%H>o5)p)mD9+t}^a(Pbx zkK(;@d0znU#|JcwNzo5#_>hXzQuBuc2;n0dKB{7;hL5TEcmRu#QSk|RpY|5vF}eGs zZ`0rC6o2IDj9fmY;nNyE6F?N7)o@mN^SIRZxd2l5yoM(v=bVNo<@u=qzJRASd@+D$ z@FlsNm+UWVcviz#G(4x_f`+fE_?n8Z3;6C$Sc&{bfwG#~Jp#&>blen})0wc$?m}wF z%nlesNm7EH>6nq+V`LNZ>=Kpy(L_$b-`Q5kr&C70RUnYbCanBG))*zDyyn1xPPuQj zb?3RGMTa6F5(28r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kmbJmVOA}hj>;zkEy_0)OdZ%5v=T<){ePObZwQ@T7 z99D4O$WC6v>fOcvXqvDDYe`+lIGo(LG z{!@gaXE_5GIqJ_-`Z@>wRrdGm9P@v$oBzq7eN%qRphpDJD>y4+IR?a5>=xVkVbqKL zVjl)Y76(Lu{c|5ZdyKGhi2g|U@KaBxJwp-#585-NQnQXB#Gq2|c6S$~=W+J9Mt#)| zO?Deh$^nbSAsoRldvS>v#8Gyv2P;IMJ&9$g6+QN(D2R%UjPn?Kb%SWd2xrn~&*WNY tlXQR}l~fT@ks>B}RH~&1H{j=x?&6TDZ(-+uu%1Gme-R)AESmNp{a>rYaR>ka literal 0 HcmV?d00001 diff --git a/target/classes/Tray.class b/target/classes/Tray.class new file mode 100644 index 0000000000000000000000000000000000000000..a5464861d797ebc14991f114696369c20706e085 GIT binary patch literal 1544 zcmZ`&Yg5xe6g^8qla^qyP(VQ`f>O#;eDV+lw2D@628J2*Q)mMQOVTMVGyWNV0psY5 zJVr-zF(>y&I_7memgW-;3jz^y&#gKY0kJI5Tq@gni*}Y5PIYg~D$|&= z9lJ6wprnU41k@$Bz>s*(cB~aIWZm2<(v!%!d9%1-mTh?soNDF0z0VrC^|JYKRv@}# zRTct7)+1(gzvfZX%MwCo&>No#W5`8j`B;AZxveud2vpNqnW`1aZfVsa9cI22XkDwA z`46wnQou*AxNDWN?d%A2q=$36=7Bj;G@YFZ-%EyxFlTJdt(Nmv)|Nt}Qp>nZHPD4_ z0|~Sn=s?myC)zbE8d$m63IbyxMgGkQnlOug&bG#> zSHQ*LV`Rjy|pz zlfR&`e+n-|0sM@RFL;C0XCVKnM}#Qv;EB zD3QTX6>6i3_R!>;;VRTd6Ix=t!rLk5IYxVx8mV9AZD~;ix z*19(VKr+LpIYd0O$z3h5)9R5TMJnDqC!o^qD1X%HEYR>nsRXz5twbc~Tt8)i5aW6U08KRam2`5*V{P5c2RQT1g2 literal 0 HcmV?d00001