Commit 9caa3d3e authored by matthias's avatar matthias
Browse files

geloest Videothek

parent 86b901dc
......@@ -5,31 +5,17 @@ public class Programm {
public static void main(String[] args) {
Videothek videothek = new Videothek();
Medium[] allMedia = new Medium[6];
Medium[] lentMedia = new Medium[6];
Medium media = new Medium(3);
Medium media2 = new Medium(3);
VHS video = new VHS(3, true);
VHS video1 = new VHS(3, false);
MusikCD musik = new MusikCD(3, 10);
MusikCD musik1 = new MusikCD(3, 25);
allMedia[0] = media;
allMedia[1] = media2;
allMedia[2] = video;
allMedia[3] = video1;
allMedia[4] = musik;
allMedia[5] = musik1;
videothek.allMedia[0] = new VHS(3, true);
videothek.allMedia[1] = new VHS(3, true);
videothek.allMedia[2] = new VHS(3, true);
videothek.allMedia[3] = new MusikCD(3, 10);
videothek.allMedia[4] = new VHS(3, true);
videothek.allMedia[5] = new VHS(3, false);
//videothek.lendAllMedia(allMedia);
videothek.lendFirstThreeMedia();
videothek.lendLastThreeMedia();
//System.out.println(lentMedia[2].price);
}
......
package videothek;
import java.lang.reflect.Array;
public class Videothek {
Medium[] lentMedia;
Medium[] allMedia = new Medium[6];
Medium[] lentMedia = new Medium[6];
......@@ -26,12 +25,20 @@ public class Videothek {
public float lendFirstThreeMedia(){
float summary = 0;
for (int i = 0; i <=2; i++){
summary += allMedia[i].price;
summary += allMedia[i].lendMedia();
}
System.out.println("Der Gesamtpreis beträgt: " + summary + " Euro.");
return summary;
}
public float lendLastThreeMedia(){
float summary = 0;
for (int i = 3; i <6; i++){
summary += allMedia[i].lendMedia();
}
System.out.println("Der Gesamtpreis beträgt: " + summary + " Euro.");
return summary;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment