Hallo Leute 
Kann mir vllt jemand kurz helfen... (tipp) geben.
Aufgabe:
Write an appropriate main-function to test your classes. Use for this purpose an array of type Publication. Assign objects of both classes to the components of the array. Iterate over the arrayand call on each object the method print.
Das mit dem Array und iterieren verstehe ich nicht ganz vllt könnt ihr mir helfen..(tipp)
Unten befinden sich die 2 Klassen von mir.
Gruß
TheSaint
Kann mir vllt jemand kurz helfen... (tipp) geben.
Aufgabe:
Write an appropriate main-function to test your classes. Use for this purpose an array of type Publication. Assign objects of both classes to the components of the array. Iterate over the arrayand call on each object the method print.
Das mit dem Array und iterieren verstehe ich nicht ganz vllt könnt ihr mir helfen..(tipp)
Unten befinden sich die 2 Klassen von mir.
Gruß
TheSaint
Java:
public class Publication {
private String title;
private String language;
private double price;
public Publication(String title, String language, double price) {
super();
this.title = title;
this.language = language;
this.price = price;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
@Override
public String toString() {
return "Title = " + getTitle() + ", Language = " + getLanguage() + ", Price = " + getPrice();
}
}
Java:
public class Book extends Publication {
private String Author;
private String ISBN;
public Book(String title, String language, double price, String author, String iSBN) {
super(title, language, price);
this.Author = author;
this.ISBN = iSBN;
}
public String getAuthor() {
return Author;
}
public void setAuthor(String author) {
this.Author = author;
}
public String getISBN() {
return ISBN;
}
public void setISBN(String iSBN) {
this.ISBN = iSBN;
}
@Override
public String toString() {
return "Author = " + getAuthor() + ", ISBN = " + getISBN() + super.toString();
}
}