From ff61287e45322dc18136b6e562d1195fcd9a887d Mon Sep 17 00:00:00 2001
From: John Tokhi <56596400+tokhij@users.noreply.github.com>
Date: Mon, 28 Oct 2019 21:42:52 -0400
Subject: [PATCH] Initial commit. Working console for atm
---
pom.xml | 16 +++++++++++--
src/main/java/Console.java | 46 ++++++++++++++++++++++++++++++++++++++
src/main/java/Main.java | 45 ++++++++++++++++++++++++++++++++++++-
3 files changed, 104 insertions(+), 3 deletions(-)
create mode 100644 src/main/java/Console.java
diff --git a/pom.xml b/pom.xml
index 9901415..6402c2c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,9 +4,21 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- io.zipcoder
- project-2-atm
+ com.zipcodewilmington
+ loop_labs
1.0-SNAPSHOT
+
+ 1.8
+ 1.8
+
+
+
+
+ junit
+ junit
+ 4.12
+
+
\ No newline at end of file
diff --git a/src/main/java/Console.java b/src/main/java/Console.java
new file mode 100644
index 0000000..4c384ff
--- /dev/null
+++ b/src/main/java/Console.java
@@ -0,0 +1,46 @@
+import java.util.InputMismatchException;
+import java.util.Scanner;
+
+public class Console {
+
+ public static String getUserInputString(String promptUser) {
+ do {
+
+ try {
+ System.out.println(promptUser);
+ String userInput = new Scanner(System.in).nextLine();
+ return userInput;
+ } catch (InputMismatchException ime) {
+ System.out.println("Invalid input, please try again.");
+ continue;
+ }
+ }
+ while (true);
+ }
+
+ public static Double getUserInputDouble(String promptUser) {
+ do {
+ try {
+ return Double.parseDouble(getUserInputString(promptUser));
+ } catch (NumberFormatException nfe) {
+ System.out.println("Invalid response please try again.");
+ continue;
+ }
+ } while (true);
+
+ }
+
+ public static Integer getUserInputInteger(String promptUser) {
+ do {
+ try {
+ return Integer.parseInt(getUserInputString(promptUser));
+ } catch (NumberFormatException nfe) {
+ System.out.println("Invalid response please try again.");
+ continue;
+ }
+ } while (true);
+
+
+ }
+
+}
diff --git a/src/main/java/Main.java b/src/main/java/Main.java
index 05e41a9..847e1f3 100644
--- a/src/main/java/Main.java
+++ b/src/main/java/Main.java
@@ -4,6 +4,49 @@
public class Main {
public static void main(String[] args){
-
+ System.out.println(" \n" +
+ ",-------.,--. ,-----. ,--. \n" +
+ "`--. / `--' ,---. ' .--./ ,---. ,-| | ,---. \n" +
+ " / / ,--.| .-. | | | | .-. |' .-. || .-. : \n" +
+ " / `--.| || '-' ' ' '--'\\' '-' '\\ `-' |\\ --. \n" +
+ "`-------'`--'| |-' `-----' `---' `---' `----' \n" +
+ " `--' ");
+
+ String userYesOrNo;
+
+ do {
+ System.out.println("Welcome to Zip Code ATM.");
+ userYesOrNo = Console.getUserInputString("Would you like to make a transaction on your account?" +
+ "\nPlease enter yes or no below:");
+
+ if (userYesOrNo.equalsIgnoreCase("yes")) {
+
+ Console.getUserInputInteger("Would you like to: "+ "\n1. Check your balance" + "\n2. Make a withdrawal" + "\n3. Make a deposit");
+
+// Enter options for atm:
+// 1. check balance
+// 2. withdraw
+ } else if (userYesOrNo.equalsIgnoreCase("no")) {
+ System.out.println("Would you like to make an account?");
+// option to create account or leave
+ }
+
+ userYesOrNo = Console.getUserInputString("Would you like to leave Zip Code ATM");
+ } while (!(userYesOrNo.equalsIgnoreCase("yes")));
+
+ System.out.println(" \n" +
+ " ,--------.,--. ,--. ,--. ,--. \n" +
+ " '--. .--'| ,---. ,--,--.,--,--, | |,-. \\ `.' /,---. ,--.,--. \n" +
+ " | | | .-. |' ,-. || \\| / '. /| .-. || || | \n" +
+ " | | | | | |\\ '-' || || || \\ \\ | | ' '-' '' '' ' \n" +
+ " `--' `--' `--' `--`--'`--''--'`--'`--' `--' `---' `----' \n" +
+ ",--. ,--. ,--. ,--.,--. ,------. \n" +
+ "| '--' | ,--,--.,--. ,--.,---. ,--,--. | ,'.| |`--' ,---. ,---. | .-. \\ ,--,--.,--. ,--. \n" +
+ "| .--. |' ,-. | \\ `' /| .-. : ' ,-. | | |' ' |,--.| .--'| .-. : | | \\ :' ,-. | \\ ' / \n" +
+ "| | | |\\ '-' | \\ / \\ --. \\ '-' | | | ` || |\\ `--.\\ --. | '--' /\\ '-' | \\ ' \n" +
+ "`--' `--' `--`--' `--' `----' `--`--' `--' `--'`--' `---' `----' `-------' `--`--'.-' / \n" +
+ " `---' ");
}
+
+
}