r/learnjava • u/NearbyDay4 • Sep 02 '19
How can I do this?
I have a constructor that stores 2 values- one for credit balance and one for debit balance. After you select you want to deposit money to one of the two accounts it will run only the methods ive created for either of the two. How do i tell main method to only run methods for credit balance account only for example? I cannot create two separate classes for each balance btw. Methods are executed through a menu. Thanks.
Not sure if that makes sense here is a paint picture.
the deposit value is taken as input.
1
u/AutoModerator Sep 02 '19
It seems that you possibly have a screenshot of code in your post How can I do this? in /r/learnjava.
Screenshots of code instead of actual code text is against the Code posting rules of /r/learnjava as is outlined in the sidebar - Code posting.
No screenshots of code!
If you posted an image merely to illustrate something, kindly ignore this message and do not repost. Your post is still visible to others. I am a bot and cannot distinguish between code screenshots and other images.
If you indeed did this wrong, please edit the post so that it uses one of the approved means of posting code.
For small bits of code (less than 50 lines in total, single classes only),
the default code formatter is fine
(one blank line before the code, then 4 spaces before each line of code).Pastebin for programs that consist of a single class only
Gist for multi-class programs, or programs that require additional files
Github or Bitbucket repositories are also perfectly fine as are other dedicated source code hosting sites.
Ideone for executable code snippets that use only the console
Please do not reply to this message, because I am a bot.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
0
Sep 03 '19
[deleted]
1
u/NearbyDay4 Sep 03 '19
Yes so i need two methods one for credit and one for debit but my problem is i have a main menu. I dont know how to deal with either value in that main menu depending on the account selected.
1
u/NearbyDay4 Sep 03 '19
Im not sure if i should make more than one main menu. So if they select deposit it will run only the methods for that account using Deposit account as an object. Similar for the other one.
1
u/NearbyDay4 Sep 03 '19
I have two fields and my constructor takes in those 2 balances as parameters.
1
u/NearbyDay4 Sep 04 '19
Anyone?