diff options
Diffstat (limited to 'Week16 Webshop/src/com/camilstaps/webshop/article')
4 files changed, 93 insertions, 0 deletions
diff --git a/Week16 Webshop/src/com/camilstaps/webshop/article/Article.java b/Week16 Webshop/src/com/camilstaps/webshop/article/Article.java new file mode 100644 index 0000000..c0e53e5 --- /dev/null +++ b/Week16 Webshop/src/com/camilstaps/webshop/article/Article.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2015 Camil Staps + */ +package com.camilstaps.webshop.article; + +/** + * + * @author camilstaps + */ +public abstract class Article { + + protected final String description; + protected final double price; + + public Article(String description, double price) { + this.description = description; + this.price = price; + } + + public String getDescription() { + return description; + } + + public double getPrice() { + return price; + } + + public abstract double getShippingCosts(); + +} diff --git a/Week16 Webshop/src/com/camilstaps/webshop/article/WashingMachine.java b/Week16 Webshop/src/com/camilstaps/webshop/article/WashingMachine.java new file mode 100644 index 0000000..37325f5 --- /dev/null +++ b/Week16 Webshop/src/com/camilstaps/webshop/article/WashingMachine.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2015 Camil Staps + */ +package com.camilstaps.webshop.article; + +/** + * + * @author camilstaps + */ +public class WashingMachine extends Article { + + public WashingMachine() { + super("Washing machine", 499); + } + + @Override + public double getShippingCosts() { + return 30; + } + +} diff --git a/Week16 Webshop/src/com/camilstaps/webshop/article/WaterMelon.java b/Week16 Webshop/src/com/camilstaps/webshop/article/WaterMelon.java new file mode 100644 index 0000000..0cdf1d4 --- /dev/null +++ b/Week16 Webshop/src/com/camilstaps/webshop/article/WaterMelon.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2015 Camil Staps + */ +package com.camilstaps.webshop.article; + +/** + * + * @author camilstaps + */ +public class WaterMelon extends Article { + + public WaterMelon() { + super("Watermelon", 4.5); + } + + @Override + public double getShippingCosts() { + return 6.75; + } + +} diff --git a/Week16 Webshop/src/com/camilstaps/webshop/article/WineGlass.java b/Week16 Webshop/src/com/camilstaps/webshop/article/WineGlass.java new file mode 100644 index 0000000..81e38e5 --- /dev/null +++ b/Week16 Webshop/src/com/camilstaps/webshop/article/WineGlass.java @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2015 Camil Staps + */ +package com.camilstaps.webshop.article; + +/** + * + * @author camilstaps + */ +public class WineGlass extends Article { + + public WineGlass() { + super("Wine glass", 8.5); + } + + @Override + public double getShippingCosts() { + return 6.75; + } + +} |