Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,775 members, 7,817,199 topics. Date: Saturday, 04 May 2024 at 08:07 AM

Please Help Out - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Please Help Out (906 Views)

Pls Python Guru Help Out / Java Programmers Plz Help Out / Expert In The House Should Help Out, Pls. (2) (3) (4)

(1) (Reply) (Go Down)

Please Help Out by DONADAMS(m): 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(m): 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(m): 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)

Facts About CRM System / Please Dont Laugh At Me / CHECK Out My Easybank Landing Page With HTML ,CSS And Little React Js

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 10
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.