constructor - Using if/else statements in setters -


in uml telling me not let field update if value negative

public void setcurrentbalance(double currentbalance) {     if (currentbalance <= 0)         this.currentbalance = currentbalance;     else         this.currentbalance = currentbalance; } 

does correct if constructor looks like:

    setaccountnumber(accountnumber);     setownerfirstname(ownerfirstname);     setownerlastname(ownerlastname);     setcurrentbalance(currentbalance);     setminimumbalancerequired(minimumbalancerequired); 


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -