+Hausaufgaben
parent
903cf4fa16
commit
a5b1784e05
@ -0,0 +1,17 @@
|
||||
package com.company.OnlineShop;
|
||||
|
||||
import java.net.http.WebSocket;
|
||||
|
||||
public class Article {
|
||||
private int articleNumber;
|
||||
private double price;
|
||||
|
||||
public Article(int articleNumber, double price){
|
||||
this.articleNumber = articleNumber;
|
||||
this.price= price;
|
||||
}
|
||||
|
||||
public double getPrice(){
|
||||
return this.price;
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.company.OnlineShop;
|
||||
|
||||
public class Book extends Article{
|
||||
|
||||
public static double VAT = 0.07;
|
||||
private String author = "";
|
||||
private String title = "";
|
||||
private int year = 0;
|
||||
|
||||
public Book(int articleNumber, double price, String author, String title, int year){
|
||||
super(articleNumber, price);
|
||||
this.author = author;
|
||||
this.title = title;
|
||||
this.year = year;
|
||||
}
|
||||
|
||||
|
||||
public double getPrice(){
|
||||
return super.getPrice() + ( VAT + 1);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.company.OnlineShop;
|
||||
|
||||
public class DVD extends Article {
|
||||
|
||||
public static double VAT = 0.19;
|
||||
private String Name = "";
|
||||
private int Duration= 0;
|
||||
private int CountryCode = 0;
|
||||
|
||||
public DVD(int articleNumber, double price, String Name, int Duration, int CountryCode){
|
||||
super(articleNumber, price);
|
||||
this.Name = Name;
|
||||
this.Duration = Duration;
|
||||
this.CountryCode = CountryCode;
|
||||
}
|
||||
|
||||
|
||||
public double getPrice(){
|
||||
return super.getPrice() + ( VAT + 1);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.company.OnlineShop;
|
||||
|
||||
public class ShopingCard {
|
||||
public static void main(String[] args){
|
||||
Article article = new Book(10, 34.9997, "WebSockets", "Luigi Lo lacono", 2015);
|
||||
DVD dvd1 = new DVD(20, 17.7905, "Spiel mir das Lied vom Tod", 1, 1);
|
||||
DVD dvd2 = new DVD(21, 9.996, "Casablanca", 1, 1);
|
||||
}
|
||||
|
||||
public void showBill(){
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.company.audioEffekte;
|
||||
|
||||
public class AudioEffectPlayer {
|
||||
private String[] audioEffect;
|
||||
|
||||
public void play(int index){
|
||||
|
||||
|
||||
}
|
||||
public void addEffect(Audioeffekt audioeffekt){
|
||||
|
||||
|
||||
}
|
||||
public void removeEffect(int index){
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.company.audioEffekte;
|
||||
|
||||
abstract class Audioeffekt {
|
||||
|
||||
protected String dateiname;
|
||||
|
||||
public Audioeffekt(String dateiname){
|
||||
|
||||
}
|
||||
|
||||
public void playEffect(){
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.company.audioEffekte;
|
||||
|
||||
public class MP3Effekt extends Audioeffekt {
|
||||
|
||||
public MP3Effekt(String dateiname){
|
||||
this.dateiname = "MP3Effekt";
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.company.audioEffekte;
|
||||
|
||||
public class OGGEffekt extends Audioeffekt{
|
||||
|
||||
public OGGEffekt(String dateiname){
|
||||
this.dateiname = "OGGEffect";
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.company.audioEffekte;
|
||||
|
||||
public class WAVEffect extends Audioeffekt{
|
||||
|
||||
public WAVEffect(String dateiname){
|
||||
this.dateiname = "WAVEffect";
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package com.company.audioEffekte;
|
||||
|
||||
public class main {
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.company.lampe;
|
||||
|
||||
import java.security.PublicKey;
|
||||
|
||||
public class Bulb extends Lamp{
|
||||
public Bulb(){
|
||||
this.Watt = 60;
|
||||
}
|
||||
public int power(int hourPerDay){
|
||||
return PowerConsuption(this.Watt);
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.company.lampe;
|
||||
|
||||
public class LEDBulb extends Lamp{
|
||||
public LEDBulb(){
|
||||
this.Watt = 9;
|
||||
}
|
||||
public int power(int hourPerDay){
|
||||
return PowerConsuption(this.Watt);
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.company.lampe;
|
||||
|
||||
public class Lamp {
|
||||
|
||||
protected int Watt;
|
||||
public int PowerConsuption(int hoursPerDay){
|
||||
|
||||
return (this.Watt*hoursPerDay*365)/1000;
|
||||
}
|
||||
public int getWatt(){
|
||||
|
||||
return this.Watt;
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package com.company.lampe;
|
||||
|
||||
public class main {
|
||||
public static void main(String[] args){
|
||||
LEDBulb led = new LEDBulb();
|
||||
Bulb bulb = new Bulb();
|
||||
|
||||
System.out.println("The LED lamp consumes "+led.power(5)+" kWh per hour");
|
||||
System.out.println("The lamp consumes "+bulb.power(5)+" kWh per hour");
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.company.voegel;
|
||||
|
||||
public class Ente extends Vogel{
|
||||
|
||||
boolean kannSchwimmen = true;
|
||||
void sagHallo(){
|
||||
System.out.println("Quak");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
package com.company.voegel;
|
||||
|
||||
public class Papageil extends Vogel{
|
||||
void sagHallo(){
|
||||
System.out.println("Hallo");
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.company.voegel;
|
||||
|
||||
public class RentnerPapageil extends Papageil{
|
||||
void sagHallo(){
|
||||
for (int i = 0; i < 3; i++){
|
||||
System.out.println("Hallo ");
|
||||
}
|
||||
}
|
||||
|
||||
String getName(){
|
||||
System.out.println(name);
|
||||
return name;
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package com.company.voegel;
|
||||
|
||||
public class Vogel {
|
||||
|
||||
String name;
|
||||
protected boolean kannFliegen = true;
|
||||
|
||||
void sagHallo(){
|
||||
}
|
||||
|
||||
String getName(){
|
||||
return name;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.company.voegel;
|
||||
|
||||
public class voegelMain {
|
||||
|
||||
public static void main(String[] args){
|
||||
|
||||
Ente e = new Ente();
|
||||
RentnerPapageil RP = new RentnerPapageil();
|
||||
|
||||
System.out.println(e.kannFliegen);
|
||||
RP.sagHallo();
|
||||
|
||||
Vogel vogel1, vogel2, vogel3;
|
||||
vogel1 = new Ente();
|
||||
vogel1.sagHallo();
|
||||
vogel2 = new Papageil();
|
||||
vogel2.sagHallo();
|
||||
vogel3 = new RentnerPapageil();
|
||||
vogel3.sagHallo();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue