Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package Domein;
- /**
- *
- * @author Laurent De Craene
- */
- public class Product
- {
- private String naam;
- private double prijsExclBtw;
- private int btwPercentage;
- private int korting6StuksPercentage;
- public Product(String naam, double prijsExclBtw, int btwPercentage,
- int korting6StuksPercentage)
- {
- this.setNaam(naam);
- this.setPrijsExclBtw(prijsExclBtw);
- this.setBtwPercentage(btwPercentage);
- this.setKorting6StuksPercentage(korting6StuksPercentage);
- }
- public final void setNaam(String naam)
- {
- if (naam.equals(""))
- {
- this.naam = "onbekend";
- } else
- {
- this.naam = naam;
- }
- }
- public final void setPrijsExclBtw(double prijsExclBtw)
- {
- this.prijsExclBtw = prijsExclBtw;
- }
- public final void setBtwPercentage(int btwPercentage)
- {
- if (6 <= btwPercentage && btwPercentage <= 21)
- {
- this.btwPercentage = btwPercentage;
- } else
- {
- this.btwPercentage = 21;
- }
- }
- public final void setKorting6StuksPercentage(int korting6StuksPercentage)
- {
- if (0 < korting6StuksPercentage && korting6StuksPercentage < 50)
- {
- this.korting6StuksPercentage = korting6StuksPercentage;
- } else
- {
- this.korting6StuksPercentage = 0;
- }
- }
- public String getNaam()
- {
- return naam;
- }
- public double getPrijsExclBtw()
- {
- return prijsExclBtw;
- }
- public int getBtwPercentage()
- {
- return btwPercentage;
- }
- public int getKorting6StuksPercentage()
- {
- return korting6StuksPercentage;
- }
- public double berekenPrijsMetBtw()
- {
- double prijsMetBtw;
- prijsMetBtw = prijsExclBtw * (btwPercentage / 100);
- return prijsMetBtw;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement