Aufgabe ist es ein Kassensystem zu programmieren, die jeweiligen Preise zu lesen, Rabbat und Steuern berechnen, diese addieren und subtrahieren etc.
Ich habe bis jetzt folgenden Code:
Das Problem ist, dass ich irgendwie den price nicht gelesen kriege.
Ich habe folgendes Testprogramm erstellt:
Folgender Kompilierfehler tritt auf:
C:\Progs\uebung7\KasseProgramm.java:4: cannot resolve symbol
symbol : class Buch
location: class KasseProgramm
Buch test = new Buch();
^
Ich weiß nicht mehr weiter. Buch ist doch genau so geschrieben wie Buch oder nicht o.o
Ich habe bis jetzt folgenden Code:
Code:
public class Kasse {
public class Item {
protected float price;
protected int id;
public Item() {
}
public float getPrice() {
return price;
}
public int getId() {
return id;
}
}
public class Kleidung extends Item {
protected int size, materialId;
public int getSize() {
return size;
}
public int getMaterialId() {
return materialId;
}
}
public class Lebensmittel extends Item {
protected int expiration;
public int getExp() {
return expiration;
}
}
public class Buch extends Item {
protected int isbn = 556;
protected String author = "Otto", title = "Das Grauen";
public Buch() {
id = 0;
price = 10.0f;
}
public int getISBN() {
return isbn;
}
public String getAuthor() {
return author;
}
public String getTitle() {
return title;
}
}
public class Hose extends Kleidung {
protected int length = 20;
public Hose() {
id = 1;
price = 50.0f;
size = 20;
materialId = 3;
}
public int getLength() {
return length;
}
}
public class Shirt extends Kleidung {
public Shirt() {
id = 2;
price = 20.0f;
size = 13;
materialId = 2;
}
}
public class Bier extends Lebensmittel {
public Bier() {
id = 3;
price = 1.0f;
expiration = 5;
}
}
public class Kaffee extends Lebensmittel {
public Kaffee() {
id = 4;
price = 1.0f;
expiration = 4;
}
}
public class Nudeln extends Lebensmittel {
protected float kochzeit = 4.30f;
public Nudeln() {
id = 5;
price = 1.0f;
expiration = 3;
}
public float getKochzeit() {
return kochzeit;
}
}
// Steuern
public float steuernBuch() {
return Buch.price/10 + Buch.price;
}
}
Das Problem ist, dass ich irgendwie den price nicht gelesen kriege.
Ich habe folgendes Testprogramm erstellt:
Code:
public class KasseProgramm {
public static void main(String [] args) {
Buch test = new Buch();
System.out.println(test.price);
}
}
Folgender Kompilierfehler tritt auf:
C:\Progs\uebung7\KasseProgramm.java:4: cannot resolve symbol
symbol : class Buch
location: class KasseProgramm
Buch test = new Buch();
^
Ich weiß nicht mehr weiter. Buch ist doch genau so geschrieben wie Buch oder nicht o.o