Question: Use JOptionPane for Steps 2-4. 2. Display Welcome Screen 3. Allow user to slide card a. Simulate card sliding by asking user to enter account

Use JOptionPane for Steps 2-4.

2. 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 PINt 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

7. Stop Algorithm

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}

**************************************************************************

I have two classes and I am trying to get the pin number and the account number to match but I am having trouble. Here is the code.

import javax.swing.*; import java.io.*; import java.util.*; import java.lang.*; public class ATMu { public static void main (String[]args) throws IOException { JOptionPane.showMessageDialog(null,"Welcome"); for (int i=0;i<3;i++) { String ACCT = JOptionPane.showInputDialog(null,"Enter Account Number"); int AP=Integer.parseInt(ACCT); Account_info A1=new Account_info(AP); if(AP==A1.TestAcct()) { i=2; } else { JOptionPane.showMessageDialog(null,"Wrong Acount Number"); } if(AP==A1.TestAcct()) { for(i=0;i<3;i++) { String PIN=JOptionPane.showInputDialog(null,"Enter PIN Number"); int num=Integer.parseInt(PIN); Account_info A2=new Account_info(num); System.out.println(A1.Aind()+" "+A2.Pind()); if(num==A2.TestPin()&& A1.Aind()==A2.Pind()) { i=2; } else { JOptionPane.showMessageDialog(null,"Wrong PIN"); }

} } } } }

******************************************************

public class Account_info { // instance variables - replace the example below with your own private int Card; private int[] AcctN={1234,2341,3412,4123}; private int[] Pin={234,341,412,123}; private int Aind=0; private int Pind=0; private int A; private int P; public Account_info(int C1) { Card=C1; } public int TestAcct() { for(int I=0;I<4;I++) { if(Card==AcctN[I]) { A=AcctN[I]; } if(Card!=AcctN[I]) { Aind=I; } } return A; } public int TestPin() { for(int I=0;I<4;I++) { if(Card==Pin[I]) { P=Pin[I]; } if(Card!=Pin[I]) { Pind=I; } } return P; } public int Aind() { return Aind; } public int Pind() { return Pind; } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!