File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes ATM program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ATM program" Watch "ATM program" New topic

ATM program

edward grace

Joined: Dec 19, 2009
Posts: 1
ok so i have to create an atm program. the program allows for input of a pin and then searches a raf in the first screen, it then moves onto a second menu where the option to withdrawal, check balance, or make a quick withdrawal comes up, and from there either goes to another screen and exits and so on, my problem is i can not figure out how to get the account number into my other classes and because java does not have global variable i can not figure it out, any help is appreciated, and for now my code looks bad but i was planning to clean it up when i was finished with it

thats my atm class which then calls

and that class is part of my problem i can not figure out how to get the account information from the first class into this class so that i can get the money info

any help is appreciated and thanks in advanced

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

You'll want to pass your variable into your options class. This can be done a couple of ways. I'm showing a simplified version that you can apply to your code:


Your Options class would need an overloaded constructor for the first example or a setter in the second example.

GenRocket - Experts at Building Test Data
David Newton

Joined: Sep 29, 2008
Posts: 12617

On a vaguely-related note, it's "withdrawal". "Withdrawl" is how we speak here on the ranch.
I agree. Here's the link:
subject: ATM program
It's not a secret anymore!