Compare commits
1 Commits
master
...
PrototypWi
Author | SHA1 | Date | |
---|---|---|---|
834a48175f |
13
ATM/.idea/compiler.xml
Normal file
13
ATM/.idea/compiler.xml
Normal file
@ -0,0 +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="ATM" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
7
ATM/.idea/encodings.xml
Normal file
7
ATM/.idea/encodings.xml
Normal file
@ -0,0 +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>
|
||||||
|
</project>
|
20
ATM/.idea/jarRepositories.xml
Normal file
20
ATM/.idea/jarRepositories.xml
Normal file
@ -0,0 +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>
|
||||||
|
</project>
|
14
ATM/.idea/misc.xml
Normal file
14
ATM/.idea/misc.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?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="openjdk-17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
6
ATM/.idea/vcs.xml
Normal file
6
ATM/.idea/vcs.xml
Normal 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>
|
99
ATM/.idea/workspace.xml
Normal file
99
ATM/.idea/workspace.xml
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="AutoImportSettings">
|
||||||
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
|
</component>
|
||||||
|
<component name="ChangeListManager">
|
||||||
|
<list default="true" id="f370439b-3b86-4211-acf9-0118b90c4643" name="Changes" comment="prototype upload">
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/compiler.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/jarRepositories.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/example/ATM.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/example/App.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/src/main/java/org/example/Card.java" afterDir="false" />
|
||||||
|
<change afterPath="$PROJECT_DIR$/src/test/java/org/example/AppTest.java" afterDir="false" />
|
||||||
|
</list>
|
||||||
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
|
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||||
|
</component>
|
||||||
|
<component name="FileTemplateManagerImpl">
|
||||||
|
<option name="RECENT_TEMPLATES">
|
||||||
|
<list>
|
||||||
|
<option value="Class" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="Git.Settings">
|
||||||
|
<option name="RECENT_BRANCH_BY_REPOSITORY">
|
||||||
|
<map>
|
||||||
|
<entry key="$PROJECT_DIR$/.." value="PrototypWiktor" />
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||||
|
</component>
|
||||||
|
<component name="MarkdownSettingsMigration">
|
||||||
|
<option name="stateVersion" value="1" />
|
||||||
|
</component>
|
||||||
|
<component name="ProjectId" id="2FuMbGcqabWerHQKDeZ8WEmFMGw" />
|
||||||
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||||
|
<component name="ProjectViewState">
|
||||||
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
|
<option name="showLibraryContents" value="true" />
|
||||||
|
</component>
|
||||||
|
<component name="PropertiesComponent">{
|
||||||
|
"keyToString": {
|
||||||
|
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||||
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
|
"settings.editor.selected.configurable": "preferences.keymap"
|
||||||
|
}
|
||||||
|
}</component>
|
||||||
|
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||||
|
<component name="TaskManager">
|
||||||
|
<task active="true" id="Default" summary="Default task">
|
||||||
|
<changelist id="f370439b-3b86-4211-acf9-0118b90c4643" name="Changes" comment="" />
|
||||||
|
<created>1665337585789</created>
|
||||||
|
<option name="number" value="Default" />
|
||||||
|
<option name="presentableId" value="Default" />
|
||||||
|
<updated>1665337585789</updated>
|
||||||
|
</task>
|
||||||
|
<servers />
|
||||||
|
</component>
|
||||||
|
<component name="Vcs.Log.Tabs.Properties">
|
||||||
|
<option name="TAB_STATES">
|
||||||
|
<map>
|
||||||
|
<entry key="MAIN">
|
||||||
|
<value>
|
||||||
|
<State>
|
||||||
|
<option name="FILTERS">
|
||||||
|
<map>
|
||||||
|
<entry key="branch">
|
||||||
|
<value>
|
||||||
|
<list>
|
||||||
|
<option value="origin/PrototypWiktor" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</State>
|
||||||
|
</value>
|
||||||
|
</entry>
|
||||||
|
</map>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="VcsManagerConfiguration">
|
||||||
|
<MESSAGE value="prototype upload" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="prototype upload" />
|
||||||
|
</component>
|
||||||
|
<component name="XSLT-Support.FileAssociations.UIState">
|
||||||
|
<expand />
|
||||||
|
<select />
|
||||||
|
</component>
|
||||||
|
</project>
|
25
ATM/pom.xml
Normal file
25
ATM/pom.xml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<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>ATM</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>ATM</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
69
ATM/src/main/java/org/example/ATM.java
Normal file
69
ATM/src/main/java/org/example/ATM.java
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
package org.example;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
|
public class ATM
|
||||||
|
{
|
||||||
|
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
Scanner scanner = new Scanner(System.in);
|
||||||
|
Card[] cards = new Card[2];
|
||||||
|
cards[0] = new Card(1, "credit", "0001");
|
||||||
|
cards[1] = new Card(2, "debit", "1110");
|
||||||
|
while(true){
|
||||||
|
System.out.println(cards[0] + "\n" + cards[1] + "\n" + "Wsuń kartę(podaj id):");
|
||||||
|
int index = scanner.nextInt()-1;
|
||||||
|
System.out.println("brrrrrrrrr... \n Proszę podać PIN:");
|
||||||
|
if(!Objects.equals(scanner.next(), cards[index].getPIN())){
|
||||||
|
System.out.println("Zły PIN");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
boolean running = true;
|
||||||
|
while(running) {
|
||||||
|
System.out.println("""
|
||||||
|
Wybierz co chcesz zrobić:
|
||||||
|
[0]Sprawdź stan konta
|
||||||
|
[1]Wypłać
|
||||||
|
[2]Wpłać
|
||||||
|
[3]Przelej
|
||||||
|
[4]Wygeneruj kod do telefoni pre-peidowej
|
||||||
|
[5]Koniec""");
|
||||||
|
int insertedAmount;
|
||||||
|
switch (scanner.nextInt()) {
|
||||||
|
case 0 -> System.out.println(cards[index].getFunds());
|
||||||
|
case 1 -> {
|
||||||
|
System.out.println("Wprowadź kwotę:");
|
||||||
|
insertedAmount = scanner.nextInt();
|
||||||
|
cards[index].withdrawFunds(insertedAmount);
|
||||||
|
System.out.println("ksz ksz ksz ksz...");
|
||||||
|
}
|
||||||
|
case 2 -> {
|
||||||
|
System.out.println("Wprowadź kwotę:");
|
||||||
|
insertedAmount = scanner.nextInt();
|
||||||
|
cards[index].addFunds(insertedAmount);
|
||||||
|
System.out.println("am am am...");
|
||||||
|
}
|
||||||
|
case 3 -> {
|
||||||
|
System.out.println("Wprowadź id karty do przelewu:");
|
||||||
|
int transferCard = scanner.nextInt();
|
||||||
|
System.out.println("Wprowadź kwotę:");
|
||||||
|
insertedAmount = scanner.nextInt();
|
||||||
|
cards[index].withdrawFunds(insertedAmount);
|
||||||
|
cards[transferCard - 1].addFunds(insertedAmount);
|
||||||
|
System.out.println("siup siup siup...");
|
||||||
|
}
|
||||||
|
case 4 -> {
|
||||||
|
System.out.println("Wprowadź kwotę:");
|
||||||
|
insertedAmount = scanner.nextInt();
|
||||||
|
cards[index].withdrawFunds(insertedAmount);
|
||||||
|
System.out.println((int) Math.floor(Math.random() * (999999999 - 111111111 + 1) + 111111111));
|
||||||
|
}
|
||||||
|
case 5 -> running = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
9
ATM/src/main/java/org/example/App.java
Normal file
9
ATM/src/main/java/org/example/App.java
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
package org.example;
|
||||||
|
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
System.out.println( "Hello World!" );
|
||||||
|
}
|
||||||
|
}
|
45
ATM/src/main/java/org/example/Card.java
Normal file
45
ATM/src/main/java/org/example/Card.java
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
package org.example;
|
||||||
|
|
||||||
|
public class Card {
|
||||||
|
private final int id;
|
||||||
|
private final String type;
|
||||||
|
private String PIN;
|
||||||
|
int balance;
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPIN() {
|
||||||
|
return PIN;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFunds() {
|
||||||
|
return balance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addFunds(int amount){
|
||||||
|
this.balance += amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void withdrawFunds(int amount){
|
||||||
|
this.balance -= amount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Card(int id, String type, String PIN) {
|
||||||
|
this.id = id;
|
||||||
|
this.type = type;
|
||||||
|
this.PIN = PIN;
|
||||||
|
this.balance = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "Card{" +
|
||||||
|
"id=" + id +
|
||||||
|
", type='" + type + '\'' +
|
||||||
|
", PIN='" + PIN + '\'' +
|
||||||
|
", balance=" + balance +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
38
ATM/src/test/java/org/example/AppTest.java
Normal file
38
ATM/src/test/java/org/example/AppTest.java
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
package org.example;
|
||||||
|
|
||||||
|
import junit.framework.Test;
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
import junit.framework.TestSuite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test for simple App.
|
||||||
|
*/
|
||||||
|
public class AppTest
|
||||||
|
extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Create the test case
|
||||||
|
*
|
||||||
|
* @param testName name of the test case
|
||||||
|
*/
|
||||||
|
public AppTest( String testName )
|
||||||
|
{
|
||||||
|
super( testName );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the suite of tests being tested
|
||||||
|
*/
|
||||||
|
public static Test suite()
|
||||||
|
{
|
||||||
|
return new TestSuite( AppTest.class );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rigourous Test :-)
|
||||||
|
*/
|
||||||
|
public void testApp()
|
||||||
|
{
|
||||||
|
assertTrue( true );
|
||||||
|
}
|
||||||
|
}
|
BIN
ATM/target/classes/org/example/ATM.class
Normal file
BIN
ATM/target/classes/org/example/ATM.class
Normal file
Binary file not shown.
BIN
ATM/target/classes/org/example/App.class
Normal file
BIN
ATM/target/classes/org/example/App.class
Normal file
Binary file not shown.
BIN
ATM/target/classes/org/example/Card.class
Normal file
BIN
ATM/target/classes/org/example/Card.class
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user