Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Euro {
- private int eurocenten = 0;
- private void setEuro(int bedrag) {
- if (bedrag >= 0) {
- this.eurocenten = bedrag*100;
- }
- }
- private void setEC(int bedrag) {
- if (bedrag >= 0) {
- this.eurocenten = bedrag;
- }
- }
- public int getEuro() {
- return this.eurocenten/100;
- }
- public int getEC() {
- return this.eurocenten;
- }
- public Euro() {
- }
- public Euro(int euro) {
- this.setEuro(euro);
- }
- public Euro(int euro, int ec) {
- this.setEuro(euro);
- this.setEC(this.getEC()+ec);
- }
- public boolean zelfdeBedrag(Euro other) {
- if (other != null && this.getEC()==this.getEC()) {
- return true;
- }
- return false;
- }
- public boolean isMinder(Euro other) {
- if (other != null && this.getEC() < other.getEC()) {
- return true;
- }
- return false;
- }
- public String toString() {
- return this.getEC() + " eurocenten";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment