Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,21 @@
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>io.zipcoder</groupId>
<artifactId>project-2-atm</artifactId>
<groupId>com.zipcodewilmington</groupId>
<artifactId>loop_labs</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
</dependencies>

</project>
46 changes: 46 additions & 0 deletions src/main/java/Console.java
Original file line number Diff line number Diff line change
@@ -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);


}

}
45 changes: 44 additions & 1 deletion src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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" +
" `---' ");
}


}