Skip to content
Snippets Groups Projects
Commit 99fa8f06 authored by Andreas's avatar Andreas
Browse files

Made Item and ItemOverview abstract

parent 047bb591
No related branches found
No related tags found
1 merge request!5Created register for storing information on Income and Expense
Pipeline #204642 failed
......@@ -70,7 +70,7 @@ public abstract class Item {
*/
public void setAmount(double amount) {
if(amount <= 1.0f ) {
throw new IllegalArgumentException("A positive amount must be provided.");
throw new IllegalArgumentException("A positive amount must be provided");
}
this.amount = amount;
}
......
......@@ -3,7 +3,7 @@ package no.ntnu.idatt1002.demo.data.Economics;
import java.util.ArrayList;
/**
* ItemOverview is an abstract class for storing and getting
* ItemOverview is an abstract class for storing and getting.
* information on items. Superclass for Income- and ExpenseOverview.
*/
public abstract class ItemOverview {
......@@ -17,8 +17,8 @@ public abstract class ItemOverview {
}
/**
* Class constructor that takes in an ArrayList of Item´s as argument
* @param items An ArrayList of the Item´s you want to overview
* Class constructor that takes in an ArrayList of Item´s as argument.
* @param items An ArrayList of the Item´s you want to overview.
*/
public ItemOverview(ArrayList<Item> items){
this.items = items;
......@@ -44,8 +44,8 @@ public abstract class ItemOverview {
}
/**
* Get the sum of all Item´s in items
* @return Sum of all Item´s
* Get the sum of all Item´s in items.
* @return Sum of all Item´s.
*/
public double getTotalSum(){
return items.stream().map(Item::getAmount).mapToDouble(Double::doubleValue).sum();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment