aboutsummaryrefslogtreecommitdiff
path: root/Week9/src/com/camilstaps/shop/Article.java
diff options
context:
space:
mode:
authorCamil Staps2015-04-18 00:26:48 +0200
committerCamil Staps2015-04-18 00:26:48 +0200
commit6dd7405206b2babfe491b59250f4d1d7f78e654b (patch)
treea5e53ec980a4cbdce038dd0beb3c8fe71fa0e80c /Week9/src/com/camilstaps/shop/Article.java
parentAdded tarball w8 (diff)
Week9
Diffstat (limited to 'Week9/src/com/camilstaps/shop/Article.java')
-rw-r--r--Week9/src/com/camilstaps/shop/Article.java89
1 files changed, 89 insertions, 0 deletions
diff --git a/Week9/src/com/camilstaps/shop/Article.java b/Week9/src/com/camilstaps/shop/Article.java
new file mode 100644
index 0000000..92b496f
--- /dev/null
+++ b/Week9/src/com/camilstaps/shop/Article.java
@@ -0,0 +1,89 @@
+/**
+ * Copyright (c) 2015 Camil Staps <info@camilstaps.nl>
+ * See the LICENSE file for copying permission.
+ */
+
+package com.camilstaps.shop;
+
+import java.io.File;
+
+/**
+ * An Article in the webshop
+ * @author Camil Staps, s4498062
+ */
+public class Article extends DatabaseItem {
+
+ /**
+ * Basic data about the article
+ */
+ private final String name;
+ private String description;
+ private final Category category;
+ private File multimedia;
+ private final float price;
+
+ /**
+ * The user who added the article
+ */
+ private final User user;
+
+ /**
+ * Straightforwardly creating a new article
+ * @param user
+ * @param name
+ * @param category
+ * @param price
+ */
+ public Article(User user, String name, Category category, float price) {
+ this.user = user;
+ this.name = name;
+ this.category = category;
+ this.price = price;
+ }
+
+ public User getUser() {
+ return user;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Category getCategory() {
+ return category;
+ }
+
+ public File getMultimedia() {
+ return multimedia;
+ }
+
+ public float getPrice() {
+ return price;
+ }
+
+ /**
+ * Set a new description
+ * @param description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Set multimedia
+ * @param multimedia
+ */
+ public void setMultimedia(File multimedia) {
+ this.multimedia = multimedia;
+ }
+
+ @Override
+ public String toString() {
+ return name + " (" + category.getName() + "): " + Float.toString(price);
+ }
+
+} \ No newline at end of file