Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.42 KB | None | 0 0
  1. /**
  2.  * The type Artikel.
  3.  */
  4. public class Artikel {
  5.  
  6.     private int anzahl;
  7.     private String artikelname;
  8.     private static int id=0;
  9.     private double gewicht;
  10.     private double gesamtgewicht;
  11.  
  12.     public void setAnzahl(int anzahl) {
  13.         this.anzahl = anzahl;
  14.     }
  15.  
  16.     public void setArtikelname(String artikelname) {
  17.         this.artikelname = artikelname;
  18.     }
  19.  
  20.     public static void setId(int id) {
  21.         Artikel.id = id;
  22.     }
  23.  
  24.     public void setGewicht(double gewicht) {
  25.         this.gewicht = gewicht;
  26.     }
  27.  
  28.     public void setGesamtgewicht(double gesamtgewicht) {
  29.         this.gesamtgewicht = gesamtgewicht;
  30.     }
  31.  
  32.     public Artikel(){
  33.         this.anzahl=1;
  34.         this.artikelname = "";
  35.         this.gewicht=0;
  36.         this.gesamtgewicht=gewicht*anzahl;
  37.         id++;
  38.     }
  39.     /**
  40.      * Instantiates a new Artikel.
  41.      *
  42.      * @param anzahl      the anzahl
  43.      * @param artikelname the artikelname
  44.      * @param gewicht     the gewicht
  45.      */
  46.     public Artikel(int anzahl, String artikelname, double gewicht){
  47.         this.anzahl=anzahl;
  48.         this.artikelname=artikelname;
  49.         this.gewicht=gewicht;
  50.         this.gesamtgewicht=gewicht*anzahl;
  51.         id++;
  52. //kerwchooooooooooo
  53.     }
  54.  
  55.     /**
  56.      * Instantiates a new Artikel.
  57.      *
  58.      * @param anzahl      the anzahl
  59.      * @param artikelname the artikelname
  60.      */
  61.     public Artikel(int anzahl, String artikelname){
  62.         this.anzahl=anzahl;
  63.         this.artikelname=artikelname;
  64.         id++;
  65.     }
  66.  
  67.  
  68.     /**
  69.      * Anzahlchange int.
  70.      *
  71.      * @param anzahl the anzahl
  72.      * @return the int
  73.      */
  74.     public int anzahlchange(int anzahl){
  75.         return this.anzahl=anzahl;
  76.     }
  77.  
  78.     /**
  79.      * Gets artikelname.
  80.      *
  81.      * @return the artikelname
  82.      */
  83.     public String getArtikelname() {
  84.         return artikelname;
  85.     }
  86.  
  87.     /**
  88.      * Gets anzahl.
  89.      *
  90.      * @return the anzahl
  91.      */
  92.     public int getAnzahl() {
  93.         return anzahl;
  94.     }
  95.  
  96.     /**
  97.      * Gets id.
  98.      *
  99.      * @return the id
  100.      */
  101.     public int getId() {
  102.         return id;
  103.     }
  104.  
  105.     /**
  106.      * Gets gewicht.
  107.      *
  108.      * @return the gewicht
  109.      */
  110.     public double getGewicht() { return gewicht; }
  111.  
  112.     /**
  113.      * Gets gesamtgewicht.
  114.      *
  115.      * @return the gesamtgewicht
  116.      */
  117.     public double getGesamtgewicht() { return gesamtgewicht; }
  118.    
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement