aboutsummaryrefslogtreecommitdiff
path: root/Week9/src/com/camilstaps/shop/Order.java
diff options
context:
space:
mode:
Diffstat (limited to 'Week9/src/com/camilstaps/shop/Order.java')
-rw-r--r--Week9/src/com/camilstaps/shop/Order.java67
1 files changed, 0 insertions, 67 deletions
diff --git a/Week9/src/com/camilstaps/shop/Order.java b/Week9/src/com/camilstaps/shop/Order.java
deleted file mode 100644
index 2b0c5a7..0000000
--- a/Week9/src/com/camilstaps/shop/Order.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * Copyright (c) 2015 Camil Staps <info@camilstaps.nl>
- * See the LICENSE file for copying permission.
- */
-
-package com.camilstaps.shop;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * An order is a set of articles, purchased by a user
- * @author Camil Staps, s4498062
- */
-public class Order extends DatabaseItem {
-
- private final Set<Article> articles;
- private final User user;
- private boolean paid = false;
-
- /**
- * This constructor takes the articles from the Cart of the User, and clears
- * that Cart afterwards.
- * @param user
- */
- public Order(User user) {
- this.user = user;
- articles = new HashSet<>();
- for (Article a : user.getCart().getArticles()) {
- articles.add(a);
- }
- user.getCart().getArticles().clear();
- }
-
- public User getUser() {
- return user;
- }
-
- public Set<Article> getArticles() {
- return articles;
- }
-
- public void setPaid(boolean set) {
- paid = set;
- }
-
- /**
- * See whether payment has been received for this article already
- * @return
- */
- public boolean isPaid() {
- return paid;
- }
-
- /**
- * Get the total price of all articles
- * @return
- */
- public float getTotalAmount() {
- float result = 0;
- for (Article a : articles) {
- result += a.getPrice();
- }
- return result;
- }
-
-}