2 Replies - 185 Views - Last Post: 03 December 2017 - 04:32 PM Rate Topic: -----

#1 Dimlead   User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 12
  • Joined: 03-December 17

create a system for a bank ATM machine

Posted 03 December 2017 - 04:20 PM

I need help for this assignment I'm doing for school since I can't figure out how to do it. Also I tried to fix the problem over the internet by look up for answers but I can't find any answer for my specific problem since I have some specific guideline that I have to follow for this assignment, so I thought the best idea was to post it on a forum since I'm going to get answered specifically for my problem.

These are the following guidelines that I have to follow:

You are required to write a program (java class) to create a system for a bank ATM machine.
Hard code the users for the system. Each user will have a name, password, and balance and overdraft facility. (These must all be stored in arrays.)
The user will be asked to log in to the ATM using a method which should return the position (index) of the user in the array.
Once they log in they will have a Display Menu (method) with options to View Bank Statement (method), Change Password (method), Deposit Money (method), Withdraw Money (method) and Exit (method). The menu should loop until the user chooses to Exit. (The new password cannot be a password that is already in use.)
The arrays must be updated when the user deposits or withdraws money or changes a password.
The user can only withdraw more money than they have in their account if they have an overdraft facility.
There is no limit on the overdraft.
All inputs must be validated for error checking using a method.

 * @(#)Assigment2.java
 * @author
 * @version 1.00 2017/12/1

import java.util.Scanner;//java library class
public class Assigment2 {//start class

	//global variable
	static int creditsbalanceArray []={156,256,504};// user currency balance
    static String nameArray []={"Molly","Connor","Shane"};// user name
    static int passcodeArray []= {6543,7654,8765};// user passcode
    static int overdraftArray []={1,2,3};// user overdraft
    static int passcode;// user passcode
    static Scanner input = new Scanner(System.in);//static Scanner input
    static int index;// user index
	public static void main(String[] args) {//start main method

      	showAllUsers();//show All user variable
    	loginBankMachine();//login Bank Machine variable
    	showAlternativeOptions();//show Alternative Options variable

    }//end main method

    public static void showAllUsers(){//start showAllUsers method
		System.out.println("  All Users");// All Users
		System.out.println("INDEX\tNAME\t$ BAL\tPASSCODE");//user options
		for(int i=0;i<creditsbalanceArray.length;i++){//intializing credit balance Array
			System.out.println(i+"\t"+nameArray[i]+"\t"+creditsbalanceArray[i]+"\t"+passcodeArray[i]);//displaying arrays
		}// end for loop
    }//end showAllUsers method

    public static void loginBankMachine(){//start login method

		int[] accountPasscode;
		int[] d;
        int found = 0;
        System.out.println("Welcome " + d+"\nPlease Enter Passcode : ");
        int passcode = input.nextInt();

    	//find the passcode in the array
    	for (int i = 0;i <accountPasscode.length;i++){
    		if (accountPasscode[i] == passcode ){
    			found = 1;
    			index = i;
    		}//end if
    	}//end for

    	if (found == 0 ){
    		System.out.println("Not found Try again");
    	}//end if
    }//end loginATM

    public static void showAlternativeOptions(){//start ShowAlternativeOption Method
    	System.out.println(" Please select one of the following options available");
		//give the user the menu
	   	System.out.print("\n1.View Bank Machine Produced Statment \n2.Deposit credits\n3.Withdraw credits\n4.Change Passcode\n5.Exit");//user options
	   	String option =input.next();//string option

	   	switch(option){//start switch method
	   		case "1":
	   			BankMachineProducedStatement();break;//BankMachineProducedStatment option
	   		case "2":
	   			System.out.println(" Deposit Credits");break;//Deposit Credits option
			case "3":
				System.out.println(" Withdraw Credits");break;//Withdraw Credits option
			case "4":
				System.out.println(" Change Passcode");break;//Change Passcode option
			case "5":
				System.out.println(" Thank you for using our bank machine");break;//Exit option
	   	}//end switch
    }// end ShowaAlternativeOption method

	public static void BankMachineProducedStatement(){//start BankMachineProducedStatement Method
		System.out.println(" Bank Machine Produced Statment");//Bank Machine Produced Statment Description
    	System.out.println(index+"\t"+nameArray[index]+"\t"+creditsbalanceArray[index]+"\t"+passcodeArray[index]);//initalizing arrays
	}//end BankMachineProducedStatement method

	public static void DepositCredits(){//start DepositCredits Method
		System.out.println(" Credits Total");//Credits Total Description
		System.out.println(" Credit ");
		System.out.println(index+"\t"+creditsbalanceArray[index]);//initalizing arrays
	}//end DepositCredits method

	public static void WithdrawCredits(){//start WithdrawCredits Method
		System.out.println("Credits Withdrawn");//Credit Withdrawm Description
		System.out.println(index+"\t"+creditsbalanceArray[index]);//index creditsbalanceArray
	}//end WithdrawCredits method

	public static void changePasscode(){

	System.out.println("\nEnter new passcode");
		String stringpasscode=input.next();
		int passcodeArray=validateInput(passcode);
		for(int i=0;i<passcodeArray.length;i++){
			if (accountPasscode[i] == passcode){
				System.out.println("passcode taken");
			}//end if
		}//end for
	}//end changePasscode Method

	public static void Exit(){
		System.out.println("Thank you for using our bank machine");
		}//end Exit method

}//end class

These are the errors that I am having at the moment:
Compilation Errors Detected

Line: 100
cannot find symbol
symbol: method validateInput(int)
location: class Assigment2

Line: 101
int cannot be dereferenced

Line: 102
cannot find symbol
symbol: variable accountPasscode
location: class Assigment2

Hopefully someone can help me out so that I can fully finish my assignment and have all the guidelines followed from the assignment and complete, I also have to do an error check and a loop, but all of those things are stated in the guidelines, so you can read them there and help me out on what I haven't able to do, since I was not able to figure it out.

Is This A Good Question/Topic? 0
  • +

Replies To: create a system for a bank ATM machine

#2 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6643
  • View blog
  • Posts: 30,932
  • Joined: 10-May 07

Re: create a system for a bank ATM machine

Posted 03 December 2017 - 04:29 PM

** Renamed title from 'Help with Java' to be more descriptive **
Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101   User is offline

  • Games, Graphs, and Auctions
  • member icon

Reputation: 12316
  • View blog
  • Posts: 45,416
  • Joined: 27-December 08

Re: create a system for a bank ATM machine

Posted 03 December 2017 - 04:32 PM

Please avoid duplicate posting.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1