Homework Solution: Begnner Java please help with simple methods !!…

    Begnner Java please help with simple methods !! Problem: Display Welcome Screen 3. Allow user to slide card a. Simulate card sliding by asking user to enter account number i. Check account number against valid account numbers – If number is invalid allow three attempts then print error message – Please contact your financial institution – If number is valid proceed to Step 4. 4. Allow user to enter personal identification number (PIN) a. Simulate by asking user to enter account number i. Check PIN against valid PINs. – If number is invalid allow three attempts then print error message – Please contact your financial institution – If number is valid proceed to Step 5. 5. Display the main menu a. Balance Inquiry b. Fast Cash c. Withdrawal d. Deposit e. Quit 6. Allow user to choose from menu – Assume MyATM is an object. a. If choice = a proceed to the method to get the balance (i.e. MyATM.getBalance()) .   b. If choice = b proceed to the method to get the fast cash (i.e. MyATM.getFastCash()) . c. If choice = c proceed to the method to withdraw cash (i.e. MyATM.getWithdrawal()) . i. Ask user for amount of withdrawal ii. If the balance > withdrawal amount proceed with transaction – Subtract withdrawal. – Update balance. iii. If the balance < withdrawal announce insufficient funds and end transaction iv. If the balance = withdrawal amount display warning message about balance and end transaction d. If choice = d proceed to the method to accept the deposit (i.e. MyATM.getDeposit()) i. Ask user for amount of deposit ii. Update balance e. If choice = e proceed to the method to end the transaction(i.e. MyATM.endTranaction()) i. Print receipt if requested ii. Print Thank You message to customer Test Data Valid Account Numbers int [] AcctNum = { 1234, 2341, 3412, 4123} Valid PINS int [] PIN = {234, 341, 412, 123} Beginning Balances int [] InitBal = {1000, 2000, 300, 0} ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, MY CODE: ATM.java import javax.swing.*; import java.util.Scanner; public class ATM { public static void main(String args[]){ int acctnumpanel, pinnumpanel; Scanner input = new Scanner(System.in); JOptionPane.showMessageDialog(null, "Welcome to Bank "); int AcctNum[] = {1234, 2341, 3412,4123}; int PIN[]= {234, 341, 412, 123}; int InitBal[] = {1000,2000,300, 0}; acctnumpanel = Integer.parseInt(JOptionPane.showInputDialog("Please insert your account number!")); if (acctnumpanel==1234) System.out.println("valid"); if (acctnumpanel==2341) System.out.println("valid"); if (acctnumpanel==3412) System.out.println("valid"); if (acctnumpanel==4123) System.out.println("valid"); else System.out.println("Please try again"); pinnumpanel = Integer.parseInt(JOptionPane.showInputDialog("Please enter your pin number!")); if (pinnumpanel==234) System.out.println("valid"); if (pinnumpanel==341) System.out.println("valid"); if (pinnumpanel==412) System.out.println("valid"); if (pinnumpanel==123) System.out.println("valid"); else System.out.println("Please try again"); System.out.println("Welcome to main menu"); Balance balanceObject = new Balance(); balanceObject.BalanceInquiry(); FastCash fastcashobject = new FastCash(); fastcashobject.quickCash(); Withdraw withdrawObject = new Withdraw(); withdrawObject.withdrawMoney(); Deposit depositObject = new Deposit(); depositObject.depositMoney(); } Balance.java import java.util.Scanner; public class Balance { public void BalanceInquiry() { Scanner aN = new Scanner(System.in); int balance, int aN=0; System.out.println("Please select Account 1-4"); System.out.println(aN.nextLine()); switch (aN) { case 1: if (aN==1) System.out.println("Welcome Account Number 1 your balance is $1000"); break; case 2: if (aN==2) System.out.println("Welcome Account Number 2 your balance is $2000"); break; case 3: if (aN==3) System.out.println("Welcome Account Number 3 your balance is $300"); break; case 4: if (aN==4) System.out.println("Welcome Account Number 4"); break; default: System.out.println("Please Contack your Financial Institution"); } } } FastCash.java import java.util.Scanner;   public class FastCash { public void quickCash() { System.out.println(" Please enter fash cash amount"); Scanner temp = new Scanner(System.in); System.out.println(temp.nextLine()); } } Withdraw.java import java.util.Scanner;   public class Withdraw { int balance; int balance1=1000 ,balance2=2000,balance3=300, balance4 = 0; Scanner withdraw = new Scanner(System.in); public void withdrawMoney() { System.out.println(" Please enter amount you would like to withdraw"); int temp= input.nextLine(); if (acctnumpanel==1234) System.out.println("your new balance is " (balance1-withdraw)); if (acctnumpanel==2341) System.out.println("your balance is" (balance2 - withdraw)); if (acctnumpanel==3412) System.out.println("your balance is" (balance3 - withdraw)); if (acctnumpanel==4123) System.out.println("your balance is" (balance4 - withdraw)); else System.out.println("Please try again"); } Deposit.java import java.util.Scanner; public class Deposit { int balance; int balance1=1000 ,balance2=2000,balance3=300, balance4 = 0; Scanner depo = new Scanner(System.in); public void depositMoney() { System.out.println(" Please enter amount you would like to deposit"); int temp= input.nextLine(); if (acctnumpanel==1234) System.out.println("your new balance is " (balance1+temp)); if (acctnumpanel==2341) System.out.println("your balance is" (balance2 + temp)); if (acctnumpanel==3412) System.out.println("your balance is" (balance3 + temp)); if (acctnumpanel==4123) System.out.println("your balance is" (balance4 + temp)); else System.out.println("Please try again"); } }   } } } } Thx for help in advanced

    Expert Answer

     
    Here is your java ATM program: ATM Java:

    Begnner Java delight succor with sincere arrangements !!

    Problem:

    Expose Welcome Screen

    3. Concede user to slide card

    a. Simulate card sliding by exploration user to penetrate totality estimate

    i. Impede totality estimate abutting substantial totality estimates

    – If estimate is insubstantial concede three attempts then sculpture hallucination intimation – Delight adjunction your financial institution

    – If estimate is substantial produce to Step 4.

    4. Concede user to penetrate specific identification estimate (PIN)

    a. Simulate by exploration user to penetrate totality estimate

    i. Impede PIN abutting substantial PINs.

    – If estimate is insubstantial concede three attempts then sculpture hallucination intimation – Delight adjunction your financial institution

    – If estimate is substantial produce to Step 5.

    5. Expose the deep menu

    a. Equalize Inquiry

    b. Secure Coin

    c. Recedeal

    d. Carelessness

    e. Quit

    6. Concede user to appropriate from menu – Assume MyATM is an aim.

    a. If choice = a produce to the arrangement to gain the equalize (i.e. MyATM.getBalance()) .

     

    b. If choice = b produce to the arrangement to gain the secure coin (i.e. MyATM.getFastCash()) .

    c. If choice = c produce to the arrangement to recede coin (i.e. MyATM.getWithdrawal()) .

    i. Ask user restraint sum of recedeal

    ii. If the equalize > recedeal sum produce with action

    – Subtract recedeal.

    – Update equalize.

    iii. If the equalize < recedeal promulgate scant funds and object action

    iv. If the equalize = recedeal sum expose admonition intimation environing equalize and object action

    d. If choice = d produce to the arrangement to sanction the carelessness (i.e. MyATM.getDeposit())

    i. Ask user restraint sum of carelessness

    ii. Update equalize

    e. If choice = e produce to the arrangement to object the action(i.e. MyATM.endTranaction())

    i. Sculpture voucher if requested

    ii. Sculpture Thank You intimation to customer

    Test Data

    Substantial Totality Estimates

    int [] AcctNum = { 1234, 2341, 3412, 4123}

    Substantial PINS

    int [] PIN = {234, 341, 412, 123}

    Beginning Equalizes

    int [] InitBal = {1000, 2000, 300, 0}

    ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

    MY CODE:

    ATM.java

    import javax.swing.*;
    import java.util.Scanner;

    public tabulate ATM {
    public static nugatory deep(String args[]){

    int acctnumpanel, triflenumpanel;
    Scanner input = strange Scanner(System.in);

    JOptionPane.showMessageDialog(null, “Welcome to Bank “);

    int AcctNum[] = {1234, 2341, 3412,4123};
    int PIN[]= {234, 341, 412, 123};
    int InitBal[] = {1000,2000,300, 0};

    acctnumpanel = Integer.parseInt(JOptionPane.showInputDialog(“Delight implant your totality estimate!”));

    if (acctnumpanel==1234)
    System.out.println(“valid”);
    if (acctnumpanel==2341)
    System.out.println(“valid”);
    if (acctnumpanel==3412)
    System.out.println(“valid”);
    if (acctnumpanel==4123)
    System.out.println(“valid”);
    else
    System.out.println(“Delight attempt again”);

    pinnumpanel = Integer.parseInt(JOptionPane.showInputDialog(“Delight penetrate your trifle estimate!”));

    if (pinnumpanel==234)
    System.out.println(“valid”);
    if (pinnumpanel==341)
    System.out.println(“valid”);
    if (pinnumpanel==412)
    System.out.println(“valid”);
    if (pinnumpanel==123)
    System.out.println(“valid”);
    else
    System.out.println(“Delight attempt again”);

    System.out.println(“Welcome to deep menu”);

    Equalize equalizeAim = strange Equalize();
    balanceObject.BalanceInquiry();

    FastCoin securecashaim = strange SecureCash();
    fastcashobject.quickCash();

    Recede recedeAim = strange Recede();
    withdrawObject.withdrawMoney();

    Carelessness carelessnessAim = strange Carelessness();
    depositObject.depositMoney();

    }

    Balance.java

    import java.util.Scanner;

    public class Equalize {

    public void BalanceInquiry() {

    Scanner aN = new Scanner(System.in);

    int balance,

    int aN=0;

    System.out.println(“Delight fine Totality 1-4”);

    System.out.println(aN.nextLine());

    switch (aN) {

    case 1:

    if (aN==1)

    System.out.println(“Welcome Totality Estimate 1 your equalize is $1000”);

    break;

    case 2:

    if (aN==2)

    System.out.println(“Welcome Totality Estimate 2 your equalize is $2000”);

    break;

    case 3:

    if (aN==3)

    System.out.println(“Welcome Totality Estimate 3 your equalize is $300”);

    break;

    case 4:

    if (aN==4)

    System.out.println(“Welcome Totality Estimate 4”);

    break;

    default:

    System.out.println(“Delight Contack your Financial Institution”);

    }

    }

    }

    FastCash.java

    import java.util.Scanner;

     

    public class FastCoin {

    public void quickCash() {

    System.out.println(” Delight penetrate fash coin sum”);

    Scanner temp = new Scanner(System.in);

    System.out.println(temp.nextLine());

    }

    }

    Withdraw.java

    import java.util.Scanner;

     

    public class Recede {

    int balance;

    int balance1=1000 ,balance2=2000,balance3=300, equalize4 = 0;

    Scanner recede = new Scanner(System.in);

    public void withdrawMoney() {

    System.out.println(” Delight penetrate sum you would approve to recede”);

    int temp= input.nextLine();

    if (acctnumpanel==1234)

    System.out.println(“your strange equalize is ” (balance1-withdraw));

    if (acctnumpanel==2341)

    System.out.println(“your equalize is” (balance2 – recede));

    if (acctnumpanel==3412)

    System.out.println(“your equalize is” (balance3 – recede));

    if (acctnumpanel==4123)

    System.out.println(“your equalize is” (balance4 – recede));

    else

    System.out.println(“Delight attempt again”);

    }

    Deposit.java

    import java.util.Scanner;

    public class Carelessness {

    int balance;

    int balance1=1000 ,balance2=2000,balance3=300, equalize4 = 0;

    Scanner depo = new Scanner(System.in);

    public void depositMoney() {

    System.out.println(” Delight penetrate sum you would approve to carelessness”);

    int temp= input.nextLine();

    if (acctnumpanel==1234)

    System.out.println(“your strange equalize is ” (balance1+temp));

    if (acctnumpanel==2341)

    System.out.println(“your equalize is” (balance2 + temp));

    if (acctnumpanel==3412)

    System.out.println(“your equalize is” (balance3 + temp));

    if (acctnumpanel==4123)

    System.out.println(“your equalize is” (balance4 + temp));

    else

    System.out.println(“Delight attempt again”);

    }

    }

     

    }

    }

    }

    }

    Thx restraint succor in advanced

    Expert Repartee

     

    Here is your java ATM program:

    ATM Java:

    import javax.swing.*;
    import java.util.Scanner;

    public tabulate ATM
    {
    int usertry=0;
    int acctnumpanel, triflenumpanel;
    int AcctNum[] = {1234, 2341, 3412,4123};
    int totality_index=0;
    int PIN[]= {234, 341, 412, 123};
    int InitBal[] = {1000,2000,300, 0};
    boolean isac=false,ispin=false;

    boolean ImpedeAcNo() //to impede totality no
    {
    acctnumpanel = Integer.parseInt(JOptionPane.showInputDialog(“Delight implant your totality estimate!”));
    {
    for(int i=0;i<AcctNum.length;i++)
    {
    if(AcctNum[i]==acctnumpanel)
    {
    account_index=i;
    usertry=0;
    isac=true;
    return isac;
    }
    }
    }
    if(usertry>2)
    return isac;
    System.out.println(“Wrong Totality no”);
    usertry++;
    CheckAcNo();

    return isac;
    }
    boolean ImpedePinNo()//to impede trifle no
    {
    pinnumpanel = Integer.parseInt(JOptionPane.showInputDialog(“Delight penetrate your trifle estimate!”));

    if(PIN[account_index]==pinnumpanel)
    {
    usertry=0;
    ispin=true;
    return ispin;
    }
    if(usertry>2)
    return ispin;
    System.out.println(“Wrong PIN”);
    usertry++;
    CheckPinNo();
    return ispin;
    }

    int gainBalance(int refutation)//to gain equalize
    {
    return InitBal[index];

    }
    nugatory recede(int sum)//to recede
    {
    if(amount>InitBal[account_index])
    JOptionPane.showMessageDialog(null,”You dont feel that plenteous money”);
    else
    {
    InitBal[account_index]-=amount;
    JOptionPane.showMessageDialog(null,”Recede done”);
    menu();
    }

    }
    nugatory carelessness(int sum)//to carelessness
    {

    InitBal[account_index]+=amount;
    JOptionPane.showMessageDialog(null,”carelessness done”);
    menu();

    }

    nugatory menu()
    {
    int menuinput = Integer.parseInt(JOptionPane.showInputDialog(“Menun1. Equalize Inquiryn” +
    “2. Secure Coinn” +
    “3. Recedealn” +
    “4. Carelessnessn” +
    “5. Quit”));

    switch(menuinput)
    {
    case 1:
    JOptionPane.showMessageDialog(null,getBalance(account_index));
    menu();
    break;
    case 2:
    JOptionPane.showMessageDialog(null,”Sorry you didnt get any info environing this option”);
    break;
    case 3:
    int sum = Integer.parseInt(JOptionPane.showInputDialog(“Penetrate sum”));
    withdraw(amount);
    break;
    case 4:
    int carelessnesssum = Integer.parseInt(JOptionPane.showInputDialog(“Penetrate sum”));
    deposit(depositamount);
    break;
    case 5:
    System.exit(0);
    break;
    default:
    System.out.println(“wrong menu item”);
    menu();
    }
    }

    public static nugatory deep(String[] args)
    {

    ATM ob=strange ATM();
    Scanner input = strange Scanner(System.in);

    JOptionPane.showMessageDialog(null, “Welcome to Bank “);

    if(ob.CheckAcNo())
    {
    if(ob.CheckPinNo())
    {
    System.out.println(“Welcome to deep menu”);
    ob.menu();
    }
    else
    {
    JOptionPane.showMessageDialog(null, “Delight adjunction your financial institution”);
    System.exit(0);
    }

    }
    else
    {
    JOptionPane.showMessageDialog(null, “Delight adjunction your financial institution”);
    System.exit(0);
    }
    }

    }