final
This commit is contained in:
parent
8950f8d153
commit
87d8246050
@ -4,10 +4,11 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="f370439b-3b86-4211-acf9-0118b90c4643" name="Changes" comment="prototype upload">
|
||||
<list default="true" id="f370439b-3b86-4211-acf9-0118b90c4643" name="Changes" comment="added limits">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/org/example/ATM.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/example/ATM.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/org/example/Card.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/org/example/Card.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/org/example/ATM.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/org/example/ATM.class" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/target/classes/org/example/Card.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/org/example/Card.class" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -55,6 +56,14 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1665337585789</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="added limits">
|
||||
<created>1665589713998</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1665589713998</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
@ -82,7 +91,8 @@
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="prototype upload" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="prototype upload" />
|
||||
<MESSAGE value="added limits" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="added limits" />
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.example;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.Scanner;
|
||||
|
||||
@ -13,10 +14,10 @@ public class ATM
|
||||
Card[] cards = new Card[3];
|
||||
cards[0] = new Card(1, "credit", "0001");
|
||||
cards[1] = new Card(2, "debit", "1110");
|
||||
cards[2] = new Card(2, "debit", "1110");
|
||||
cards[2] = new Card(3, "debit", "1111");
|
||||
cards[2].addFunds(1000000);
|
||||
while(true){
|
||||
System.out.println(cards[0] + "\n" + cards[1] + "\n" + "Wsuń kartę(podaj id):");
|
||||
System.out.println(Arrays.toString(cards) + "\nWsuń kartę(podaj id):");
|
||||
int index = scanner.nextInt()-1;
|
||||
System.out.println("brrrrrrrrr... \n Proszę podać PIN:");
|
||||
if(!Objects.equals(scanner.next(), cards[index].getPIN())){
|
||||
@ -41,7 +42,11 @@ public class ATM
|
||||
insertedAmount = scanner.nextInt();
|
||||
if (cards[index].isLimitExceeded(insertedAmount)) {
|
||||
System.out.println("Niewystarczająca ilość środków");
|
||||
} else {
|
||||
}
|
||||
else if(cash-insertedAmount<0){
|
||||
System.out.println("nie wystarczająca ilość środków w maszynie");
|
||||
}
|
||||
else {
|
||||
cards[index].withdrawFunds(insertedAmount);
|
||||
System.out.println("ksz ksz ksz ksz...");
|
||||
}
|
||||
@ -49,12 +54,10 @@ public class ATM
|
||||
case 2 -> {
|
||||
System.out.println("Wprowadź kwotę:");
|
||||
insertedAmount = scanner.nextInt();
|
||||
if(cash-insertedAmount<0){System.out.println("nie wystarczająca ilość środków w maszynie");}
|
||||
else{
|
||||
cards[index].addFunds(insertedAmount);
|
||||
System.out.println("am am am...");
|
||||
cash+=insertedAmount;
|
||||
}
|
||||
|
||||
}
|
||||
case 3 -> {
|
||||
System.out.println("Wprowadź id karty do przelewu:");
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user