Está en la página 1de 3

import java.io.

*;
public class BankCodeMain
{
public static void main(String args []) throws IOException
{
try{
BufferedReader c = new BufferedReader (new InputStreamReader(System.in));
String pincode, pincode1, pincode2, pincode3;
float pincode4, pincode5, pincode6, pincode7;
System.out.println("Welcome to MetroBank!");
System.out.println("");
System.out.println("Enter the 6-digit PIN Code Number:");
pincode = c.readLine();
pincode4 = Float.parseFloat(pincode);
if (pincode4 == 101067) {
BankingTrans.main(args);
}
else {
System.out.println("");
System.out.println("Invalid PIN Code Number!");
System.out.println("3 tries left.");
System.out.println("");
System.out.println("Enter the 6-digit PIN Code Number:");
pincode1 = c.readLine();
pincode5 = Float.parseFloat(pincode1);
if (pincode5 == 101067) {
BankingTrans.main(args);
}
else {
System.out.println("");
System.out.println("Invalid PIN Code Number!");
System.out.println("2 tries left.");
System.out.println("");
System.out.println("Enter the 6-digit PIN Code Number:");
pincode2 = c.readLine();
pincode6 = Float.parseFloat(pincode2);
if (pincode6 == 101067) {
BankingTrans.main(args);
}
else {
System.out.println("");
System.out.println("Invalid PIN Code Number!");
System.out.println("1 try left.");
System.out.println("");
System.out.println("Enter the 6-digit PIN Code Number:");
pincode3 = c.readLine();
pincode7 = Float.parseFloat(pincode3);
if (pincode7 == 101067) {
BankingTrans.main(args);
}
else {
System.out.println("Program Terminated!");
}
}
}
}
}catch (ArithmeticException ae)
{
System.err.println("ERROR: " +ae);
}catch (NumberFormatException nfe)
{
System.err.println("ERROR: " +nfe);
} catch (NullPointerException npe)
{
System.err.println("ERROR: " +npe);
}
}
}

//Pt. 2 Banking Transaction


//Evardo
import java.io.*;
public class BankingTrans
{
public static void main(String args[]) throws IOException
{
BufferedReader banktrans = new BufferedReader(new InputStreamReader(System.in));
String transnum;
float transnum2;
try{
System.out.println("Banking Transaction:");
System.out.println("");
System.out.println(" Select Transaction:");
System.out.println(" 1 - Account Information");
System.out.println(" 2 - Savings Account");
System.out.println(" 3 - Checking Amount");
System.out.println("");
do{
System.out.println("Select your Choice [1-3]:");
transnum = banktrans.readLine();
transnum2 = Integer.parseInt(transnum);
}while (transnum2 < 1 || transnum2 > 3);
if (transnum2 == 1) {
AccountInfo.main(args);
}
else if (transnum2 == 2) {
SavingsAccnt.main(args);
}
else if (transnum2 == 3) {
CheckAccnt.main(args);
}
else {
System.out.println("");
}
}catch (ArithmeticException ae)
{
System.err.println("ERROR: " +ae);
}catch (NumberFormatException nfe)
{
System.err.println("ERROR: " +nfe);
} catch (NullPointerException npe)
{
System.err.println("ERROR: " +npe);
}
}
}

import java.io.*;
public class SavingsAccnt
{
public static void main(String args []) throws IOException
{
BufferedReader save = new BufferedReader(new InputStreamReader(System.in));
String account, deposit, withdraw, h;
double bal = 20000.00, account2, tdeposit, twithdraw;
try{
do{
System.out.println("2 - Savings Account");
System.out.println("");
System.out.println("Account Number: 456456-789");
System.out.println("Account Name: Evardo, Gabriel Jose Perez");
System.out.println("Account Balance: " +bal);
System.out.println("");
System.out.println("1 - Deposit");
System.out.println("2 - Withdraw");
System.out.println("");
do{
System.out.println("Select Transaction:");
account = save.readLine();
account2 = Integer.parseInt(account);
if (account2 == 1) {
System.out.println("");
System.out.println("1 - Deposit");
System.out.println("Enter Amount Deposit:");
deposit = save.readLine();
tdeposit = Double.parseDouble(deposit) + bal;
System.out.println("Current Amount Balance:" +tdeposit);
}
else if (account2 == 2) {
System.out.println("");
System.out.println("2 - Withdraw");
System.out.println("Current balance: " +bal);
do{
System.out.println("Enter Amount Withdraw:");
withdraw = save.readLine();
twithdraw = bal - Double.parseDouble(withdraw);
if (twithdraw >= 0) {
System.out.println("Current Amount Balance: " +twithdraw);
System.out.println("");
System.out.println("Take your cash and transaction slip.");
System.out.println("Thank You for banking with us!");
}
else {
System.out.println("");
}
}while(twithdraw < 0);
}
else {
System.out.println("");
}
}while (account2 <= 0 || account2 >2);
System.out.println("");
System.out.println("Precede Another transaction [y/n]:");
h = save.readLine();
}while(h.equalsIgnoreCase("y"));
} catch (ArithmeticException ae)
{
System.err.println("ERROR: " +ae);
}catch (NumberFormatException nfe)
{
System.err.println("ERROR: " +nfe);
} catch (NullPointerException npe)
{
System.err.println("ERROR: " +npe);
}
}
}

//Check Account
import java.io.*;
public class CheckAccnt
{
public static void main(String args[]) throws IOException
{
try{
BufferedReader check = new BufferedReader(new InputStreamReader(System.in));
float baln= 20000;
String trans;
System.out.println("Checking Account");
System.out.println("");
System.out.println("Current Balance: " +baln);
System.out.println("Precede Another Transaction [y/n]:");
trans = check.readLine();
if (trans.equalsIgnoreCase("y")) {
BankingTrans.main(args);
}
else {
System.out.println("");
}
}catch (ArithmeticException ae)
{
System.err.println("ERROR: " +ae);
}catch (NumberFormatException nfe)
{
System.err.println("ERROR: " +nfe);
} catch (NullPointerException npe)
{
System.err.println("ERROR: " +npe);
}
}
}

También podría gustarte