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

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -