Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class Artikel {
- protected String name = "" ;
- protected long id = 0;
- protected double preis = 0;
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public long getId() {
- return id;
- }
- public void setId(long id) {
- this.id = id;
- }
- public double getPreis() {
- return preis;
- }
- public void setPreis(int preis) {
- this.preis = preis;
- }
- public Bewertung getBewertung() {
- return bewertung;
- }
- public void setBewertung(Bewertung bewertung) {
- this.bewertung = bewertung;
- }
- protected Bewertung bewertung;
- }
- import java.awt.Color;
- public class Erzeuger {
- public static void main(String[] args) {
- Datenbank d = new Datenbank();
- Film harryPotter1 = new Film();
- harryPotter1.setBewertung(Bewertung.SEHRGUT);
- harryPotter1.setBeschreibung("Der britisch-US-amerikanische Fantasyfilm Harry Potter und der Stein der Weisen ist "
- + "die Verfilmung des ersten Romans der Harry-Potter-Kinderbuchreihe.");
- harryPotter1.setName("Harr Potter und der Stein der Weisen");
- harryPotter1.setPreis(10);
- harryPotter1.setId(12318);
- harryPotter1.setRegisseur("Chris Columbus");
- Handy motoXPlay = new Handy();
- motoXPlay.setBewertung(Bewertung.GUT);
- motoXPlay.setMarke("Motorola");
- motoXPlay.setModell("X Play");
- motoXPlay.setName("Moto X Play");
- motoXPlay.setFarbe(Color.black);
- motoXPlay.setPreis(350);
- motoXPlay.setId(31233);
- d.addArtikel(harryPotter1);
- d.addArtikel(motoXPlay);
- }
- }
- public enum Bewertung {
- UNGENUEGEND,MANGELHAFT,AUSREICHEND,BEFRIEDIGEND,GUT,SEHRGUT
- }
- import java.util.ArrayList;
- public class Film extends Artikel{
- private String regisseur = "";
- private ArrayList<String> schauspieler = new ArrayList<String>();
- private String beschreibung = "";
- public String getRegisseur() {
- return regisseur;
- }
- public void setRegisseur(String regisseur) {
- this.regisseur = regisseur;
- }
- public ArrayList<String> getSchauspieler() {
- return schauspieler;
- }
- public void setSchauspieler(ArrayList<String> schauspieler) {
- this.schauspieler = schauspieler;
- }
- public String getBeschreibung() {
- return beschreibung;
- }
- public void setBeschreibung(String beschreibung) {
- this.beschreibung = beschreibung;
- }
- }
- import java.util.ArrayList;
- public class Datenbank {
- private ArrayList<Artikel> artikel = new ArrayList<Artikel>();
- public void addArtikel(Artikel a){
- artikel.add(a);
- }
- public void rtikel(Artikel a){
- artikel.remove(a);
- }
- }
- import java.awt.Color;
- public class Handy extends Artikel{
- public String getMarke() {
- return Marke;
- }
- public void setMarke(String marke) {
- Marke = marke;
- }
- public String getModell() {
- return Modell;
- }
- public void setModell(String modell) {
- Modell = modell;
- }
- public Color getFarbe() {
- return Farbe;
- }
- public void setFarbe(Color farbe) {
- Farbe = farbe;
- }
- private String Marke = "";
- private String Modell = "";
- private Color Farbe = Color.black;
- }
Add Comment
Please, Sign In to add comment