₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,330,290 members, 8,444,805 topics. Date: Tuesday, 14 July 2026 at 05:04 AM

Toggle theme

Please Help Out - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingPlease Help Out (1015 Views)

1 Reply (Go Down)

Please Help Out by DONADAMS(op): 12:45am On Feb 11, 2019
please help out, I'm frustrated...my code isn't producing the right output...I tried debugging and still the same, I just can't discover what's wrong..it's an assignment...thanks

Re: Please Help Out by airsaylongcon: 2:46am On Feb 11, 2019
You aren't assigning a value to amt when u initialise the ba object by calling the bankAccount function. Your function just displays a value without first assigning that value to your private variable amt

amt in the class definition is a private variable and you are confusing the call that passes the amt as an assignment to the private variable. It won't work. You need to change the variable name in the function call to something else (openingBal for example) and then in the body u assign amt=openingBal before your System.out.println
Re: Please Help Out by HealerC: 10:55am On Feb 11, 2019
amt in the constructor is only in the scope of the constructor
Instead do
this.amt = amt;
in the constructor to assign the value of amt in the constructor to the global variable amt (the one outside). I still see other issues though but fix this one and see if you can figure the rest out.
Re: Please Help Out by DONADAMS(op): 10:59pm On Feb 15, 2019
airsaylongcon:
You aren't assigning a value to amt when u initialise the ba object by calling the bankAccount function. Your function just displays a value without first assigning that value to your private variable amt

amt in the class definition is a private variable and you are confusing the call that passes the amt as an assignment to the private variable. It won't work. You need to change the variable name in the function call to something else (openingBal for example) and then in the body u assign amt=openingBal before your System.out.println
thanks bro...its supposed to be openingBal=amt. it worked tho...all these constructor, accessor are confusing...I really appreciate.
Re: Please Help Out by DONADAMS(op): 11:02pm On Feb 15, 2019
HealerC:
amt in the constructor is only in the scope of the constructor
Instead do
this.amt = amt;
in the constructor to assign the value of amt in the constructor to the global variable amt (the one outside). I still see other issues though but fix this one and see if you can figure the rest out.
thanks bro..but I didn't understand this...I really appreciate
1 Reply

Who Can Help Out With This Python Problem?Pls Python Guru Help OutJava Programmers Plz Help Out234

Help In Create Virtual Environment For PythonProgrammers Needed Urgently. Check DetailsA Good Programmer In Lagos