• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

ATM program  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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


 
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:



or



Your Options class would need an overloaded constructor for the first example or a setter in the second example.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On a vaguely-related note, it's "withdrawal". "Withdrawl" is how we speak here on the ranch.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!