Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package scotch;
- /**
- *
- * @author kim-marvin.mroncz
- */
- public class Artikel {
- public int artikelNr, lagerzeit;
- public double preis, handelsspanne, mwst;
- public String bezeichnung;
- public Artikel(int artikelNr, int lagerzeit, double preis, String bezeichnung) {
- this.artikelNr = artikelNr;
- this.bezeichnung = bezeichnung;
- this.lagerzeit = lagerzeit;
- this.preis = preis;
- handelsspanne = 0.6;
- mwst = 0.19;
- }
- public void anzeigen() {
- System.out.println(""+bezeichnung+", EK-Preis: "+preis+"€, VK-Preis: "+berechneVerkaufspreis()+" , Lagerzeit: "+lagerzeit+" Monate, Art-Nr.: "+artikelNr+"");
- }
- public int berechneVerkaufspreis() {
- return (int) ((preis * (1 + handelsspanne)) * (1 + mwst));
- }
- }
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package scotch;
- /**
- *
- * @author kim-marvin.mroncz
- */
- public class Sonderposten extends Artikel {
- public double rabatt;
- public Sonderposten(int artikelNr, int lagerzeit, double preis, String bezeichnung) {
- super(artikelNr,lagerzeit,preis,bezeichnung);
- if(lagerzeit > 12) {
- rabatt = 0.7;
- } else {
- rabatt = 0.9;
- }
- }
- public static void main(String[] args) {
- Artikel a1 = new Artikel(1, 3, 10, "Scotch");
- Artikel a2 = new Artikel(2, 15, 55, "teurer Scotch");
- a1.anzeigen();
- a2.anzeigen();
- Sonderposten a3 = new Sonderposten(3,3,10,"Old Scotch");
- a3.anzeigen();
- Sonderposten a4 = new Sonderposten(4, 15, 55,"Old Scotch2");
- a4.anzeigen();
- }
- @Override
- public void anzeigen() {
- System.out.println("Sonderposten:");
- System.out.println(""+bezeichnung+", EK-Preis: "+preis+"€, VK-Preis: "+berechneVerkaufspreis()+" , Lagerzeit: "+lagerzeit+" Monate, Art-Nr.: "+artikelNr+"");
- }
- @Override
- public int berechneVerkaufspreis() {
- return (int) (((preis * (1 + handelsspanne)) * (1 + mwst)) * rabatt);
- }
- }
Add Comment
Please, Sign In to add comment