This commit is contained in:
pozny 2022-10-12 17:45:03 +02:00
parent 8ea488b7d8
commit 41e364fa07
15 changed files with 496 additions and 488 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
# Project exclude paths
/target/

16
.idea/.gitignore vendored
View File

@ -1,8 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="APO_1" />
</profile>
</annotationProcessing>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="APO_1" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

View File

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaBuddyIdeaProjectConfig">
<option name="renamerInitialized" value="true" />
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JpaBuddyIdeaProjectConfig">
<option name="renamerInitialized" value="true" />
</component>
</project>

View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="ProjectType">
<option name="id" value="jpab" />
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="ProjectType">
<option name="id" value="jpab" />
</component>
</project>

View File

@ -1,124 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

32
pom.xml
View File

@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>APO_1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>APO_1</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -1,113 +1,113 @@
package org.example;
import java.util.Scanner;
public class ATM {
private String idATM;
private int cash;
private Bank bank;
private CardBank card;
Scanner scanner = new Scanner(System.in);
public ATM(String idATM,Bank bank) {
this.idATM = idATM;
this.bank = bank;
}
public void start(CardBank cardBank){
this.card = cardBank;
//languageSelection();
for(int i = 0; i<3;i++){
if (entryPIN()) {
operationSelection();
break;
}
else System.out.println("Wrong password");
}
System.out.println("Take your card");
}
private void operationSelection(){
boolean count = true;
while (count) {
System.out.println("Choose an operation\n" +
" 1) Withdraw money\n" +
" 2) Account balance\n" +
" 3) Top up your account\n" +
" 4) Top up the phone\n" +
" 5) Money transfer");
int nOper = scanner.nextInt();
if (nOper == 1) {
cashWithdrawal();
} else if (nOper == 2) {
getBalanceBankClient();
} else if (nOper == 3) {
putCashBalance();
} else if (nOper == 4) {
topUpPhone();
}else if (nOper == 5){
moneyTransferBetweenClients();
}
System.out.println("would you like to continue?\n" +
" 1) yes\n" +
" 2) no");
if (scanner.nextInt() != 1)
count = false;
}
}
private void putCashBalance(){
System.out.println("Enter amount to withdraw");
bank.putMoneyClient(card.getIdClient(),scanner.nextFloat());
System.out.println("successfully");
}
private void getBalanceBankClient(){
System.out.println(bank.getBalanceClient(card.getIdClient()));
}
private void cashWithdrawal(){
System.out.print("Enter amount to withdraw: ");
if(bank.withdrawalMoneyFromClientAccount(card.getIdClient(),scanner.nextInt())){
System.out.println("successfully");
} else
System.out.println("failed to withdraw money");
}
private void moneyTransferBetweenClients(){
System.out.print("Submit client id for money transfer: ");
String idClient = String.valueOf(scanner.nextInt());
System.out.print("Enter amount to transfer: ");
if (bank.moneyTransfer(card.getIdClient(), idClient,scanner.nextFloat())){
System.out.println("successfully");
}else
System.out.println("operation failed");
}
private Boolean entryPIN(){
System.out.println("PIN");
return card.pinCheck(scanner.nextLine());
}
private void languageSelection(){
System.out.println("Choose language:\n 1)English\n 2)Беларуский\n 3)Deutsch ");
String lang = scanner.nextLine();
}
private void topUpPhone(){
System.out.print("Enter phone number to top up:");
scanner.nextInt();
System.out.print("Enter the amount to replenish:");
bank.withdrawalMoneyFromClientAccount(card.getIdClient(),scanner.nextInt());
System.out.println("successfully");
}
}
package org.example;
import java.util.Scanner;
public class ATM {
private String idATM;
private int cash;
private Bank bank;
private CardBank card;
Scanner scanner = new Scanner(System.in);
public ATM(String idATM,Bank bank) {
this.idATM = idATM;
this.bank = bank;
}
public void start(CardBank cardBank){
this.card = cardBank;
//languageSelection();
for(int i = 0; i<3;i++){
if (entryPIN()) {
operationSelection();
break;
}
else System.out.println("Wrong password");
}
System.out.println("Take your card");
}
private void operationSelection(){
boolean count = true;
while (count) {
System.out.println("Choose an operation\n" +
" 1) Withdraw money\n" +
" 2) Account balance\n" +
" 3) Top up your account\n" +
" 4) Top up the phone\n" +
" 5) Money transfer");
int nOper = scanner.nextInt();
if (nOper == 1) {
cashWithdrawal();
} else if (nOper == 2) {
getBalanceBankClient();
} else if (nOper == 3) {
putCashBalance();
} else if (nOper == 4) {
topUpPhone();
}else if (nOper == 5){
moneyTransferBetweenClients();
}
System.out.println("would you like to continue?\n" +
" 1) yes\n" +
" 2) no");
if (scanner.nextInt() != 1)
count = false;
}
}
private void putCashBalance(){
System.out.println("Enter amount to withdraw");
bank.putMoneyClient(card.getIdClient(),scanner.nextFloat());
System.out.println("successfully");
}
private void getBalanceBankClient(){
System.out.println(bank.getBalanceClient(card.getIdClient()));
}
private void cashWithdrawal(){
System.out.print("Enter amount to withdraw: ");
if(bank.withdrawalMoneyFromClientAccount(card.getIdClient(),scanner.nextInt())){
System.out.println("successfully");
} else
System.out.println("failed to withdraw money");
}
private void moneyTransferBetweenClients(){
System.out.print("Submit client id for money transfer: ");
String idClient = String.valueOf(scanner.nextInt());
System.out.print("Enter amount to transfer: ");
if (bank.moneyTransfer(card.getIdClient(), idClient,scanner.nextFloat())){
System.out.println("successfully");
}else
System.out.println("operation failed");
}
private Boolean entryPIN(){
System.out.println("PIN");
return card.pinCheck(scanner.nextLine());
}
private void languageSelection(){
System.out.println("Choose language:\n 1)English\n 2)Беларуский\n 3)Deutsch ");
String lang = scanner.nextLine();
}
private void topUpPhone(){
System.out.print("Enter phone number to top up:");
scanner.nextInt();
System.out.print("Enter the amount to replenish:");
bank.withdrawalMoneyFromClientAccount(card.getIdClient(),scanner.nextInt());
System.out.println("successfully");
}
}

View File

@ -1,79 +1,79 @@
package org.example;
import java.util.ArrayList;
import java.util.Objects;
public class Bank {
private ArrayList<Client> clients = new ArrayList<Client>();
private ArrayList<ATM> atm = new ArrayList<>();
private ArrayList<CardBank> cardBanks = new ArrayList<>();
public Bank() {
this.atm.add(new ATM("0", this));
this.clients.add(new Client("0",100000));
this.clients.add(new Client("1",100));
this.clients.add(new Client("2",666));
this.cardBanks.add(new CardBank("0","0"));
}
public boolean withdrawalMoneyFromClientAccount(String idClient, float sum){
Client client = findClient(idClient);
if( client != null){
if ( client.getMoney()>= sum){
return client.withdrawMoney(sum);
}
}
return false;
}
public float getBalanceClient(String idClient){
Client client = findClient(idClient);
assert client != null;
return client.getMoney();
}
public void putMoneyClient(String idClient,float sum){
Client client = findClient(idClient);
assert client != null;
client.putMoney(sum);
}
public boolean moneyTransfer(String idClient0, String idClient1, float sum){
if (findClient(idClient0) != null && findClient(idClient1) != null) {
if(withdrawalMoneyFromClientAccount(idClient0, sum)) {
putMoneyClient(idClient1, sum);
return true;
}
}
return false;
}
private Client findClient(String idCl){
for (Client client : clients) {
if (Objects.equals(client.getIdClient(), idCl))
return client;
}
return null;
}
public ArrayList<Client> getClients() {
return clients;
}
public void setClients(ArrayList<Client> clients) {
this.clients = clients;
}
public ArrayList<ATM> getAtm() {
return atm;
}
public ArrayList<CardBank> getCardBanks() {
return cardBanks;
}
public void setCardBanks(ArrayList<CardBank> cardBanks) {
this.cardBanks = cardBanks;
}
}
package org.example;
import java.util.ArrayList;
import java.util.Objects;
public class Bank {
private ArrayList<Client> clients = new ArrayList<Client>();
private ArrayList<ATM> atm = new ArrayList<>();
private ArrayList<CardBank> cardBanks = new ArrayList<>();
public Bank() {
this.atm.add(new ATM("0", this));
this.clients.add(new Client("0",100000));
this.clients.add(new Client("1",100));
this.clients.add(new Client("2",666));
this.cardBanks.add(new CardBank("0","0"));
}
public boolean withdrawalMoneyFromClientAccount(String idClient, float sum){
Client client = findClient(idClient);
if( client != null){
if ( client.getMoney()>= sum){
return client.withdrawMoney(sum);
}
}
return false;
}
public float getBalanceClient(String idClient){
Client client = findClient(idClient);
assert client != null;
return client.getMoney();
}
public void putMoneyClient(String idClient,float sum){
Client client = findClient(idClient);
assert client != null;
client.putMoney(sum);
}
public boolean moneyTransfer(String idClient0, String idClient1, float sum){
if (findClient(idClient0) != null && findClient(idClient1) != null) {
if(withdrawalMoneyFromClientAccount(idClient0, sum)) {
putMoneyClient(idClient1, sum);
return true;
}
}
return false;
}
private Client findClient(String idCl){
for (Client client : clients) {
if (Objects.equals(client.getIdClient(), idCl))
return client;
}
return null;
}
public ArrayList<Client> getClients() {
return clients;
}
public void setClients(ArrayList<Client> clients) {
this.clients = clients;
}
public ArrayList<ATM> getAtm() {
return atm;
}
public ArrayList<CardBank> getCardBanks() {
return cardBanks;
}
public void setCardBanks(ArrayList<CardBank> cardBanks) {
this.cardBanks = cardBanks;
}
}

View File

@ -1,48 +1,48 @@
package org.example;
import java.util.Objects;
public class CardBank{
private String idCard;
private Boolean blocking;
int wrongPin = 0;
private int n = 0;
private String pin;
private String idClient;
public CardBank(String idCard, String idClient) {
this.idCard = idCard;
this.blocking = false;
this.pin = "0000";
this.idClient = idClient;
}
public Boolean pinCheck(String pin0){
if(!blocking) {
if (Objects.equals(pin, pin0)) {
return true;
}else{
wrongPin++;
if (wrongPin==3){
blocking = true;
System.out.println("Card blocked, please contact your bank");
}
}
}
return false;
}
public Boolean getBlocking() {
return blocking;
}
public void setBlocking(Boolean blocking) {
this.blocking = blocking;
}
public String getIdClient() {
return idClient;
}
}
package org.example;
import java.util.Objects;
public class CardBank{
private String idCard;
private Boolean blocking;
int wrongPin = 0;
private int n = 0;
private String pin;
private String idClient;
public CardBank(String idCard, String idClient) {
this.idCard = idCard;
this.blocking = false;
this.pin = "0000";
this.idClient = idClient;
}
public Boolean pinCheck(String pin0){
if(!blocking) {
if (Objects.equals(pin, pin0)) {
return true;
}else{
wrongPin++;
if (wrongPin==3){
blocking = true;
System.out.println("Card blocked, please contact your bank");
}
}
}
return false;
}
public Boolean getBlocking() {
return blocking;
}
public void setBlocking(Boolean blocking) {
this.blocking = blocking;
}
public String getIdClient() {
return idClient;
}
}

View File

@ -1,36 +1,36 @@
package org.example;
public class Client {
private String idClient;
private float money;
public Client(String idClient, float money) {
this.idClient = idClient;
this.money = money;
}
public boolean withdrawMoney(float sum){
money=money-sum;
return true;
}
public void putMoney(float sum){
money=sum+money;
}
public String getIdClient() {
return idClient;
}
public void setIdClient(String idClient) {
this.idClient = idClient;
}
public float getMoney() {
return money;
}
public void setMoney(float money) {
this.money = money;
}
}
package org.example;
public class Client {
private String idClient;
private float money;
public Client(String idClient, float money) {
this.idClient = idClient;
this.money = money;
}
public boolean withdrawMoney(float sum){
money=money-sum;
return true;
}
public void putMoney(float sum){
money=sum+money;
}
public String getIdClient() {
return idClient;
}
public void setIdClient(String idClient) {
this.idClient = idClient;
}
public float getMoney() {
return money;
}
public void setMoney(float money) {
this.money = money;
}
}

View File

@ -1,8 +1,8 @@
package org.example;
public class Main {
public static void main(String[] args) {
Bank bank = new Bank();
bank.getAtm().get(0).start(bank.getCardBanks().get(0));
}
package org.example;
public class Main {
public static void main(String[] args) {
Bank bank = new Bank();
bank.getAtm().get(0).start(bank.getCardBanks().get(0));
}
}