-
-
Save uncoded-ro/68acde6017b283b42bad3f5cf8b10b9b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ro.virtualcampus.bank; | |
public class Cont { | |
private String numarCont; | |
private double sold; | |
public Cont(String numarCont) { | |
this.numarCont = numarCont; | |
this.sold = 0; | |
} | |
public void depune(double suma) { | |
sold += suma; | |
} | |
public void retrage(double suma) throws FonduriInsuficiente { | |
if (sold >= suma) { | |
sold -= suma; | |
} else { | |
double necesar = suma - sold; | |
throw new FonduriInsuficiente(necesar); | |
} | |
} | |
public String getNumarCont() { | |
return numarCont; | |
} | |
public void setNumarCont(String numarCont) { | |
this.numarCont = numarCont; | |
} | |
public double getSold() { | |
return sold; | |
} | |
public void setSold(double sold) { | |
this.sold = sold; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment