-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added initial calculator implementations
- Loading branch information
Showing
3 changed files
with
74 additions
and
2 deletions.
There are no files selected for viewing
32 changes: 31 additions & 1 deletion
32
src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Calculator/PurchaseCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,34 @@ | ||
| package edu.ntnu.idi.idatt2003.gruppe42.Model.Calculator; | ||
|
|
||
| public class PurchaseCalculator { | ||
| import edu.ntnu.idi.idatt2003.gruppe42.Model.Share; | ||
| import java.math.BigDecimal; | ||
|
|
||
| public class PurchaseCalculator implements TransactionCalculator { | ||
| private BigDecimal purchasePrice; | ||
| private BigDecimal quantity; | ||
|
|
||
| public PurchaseCalculator(Share share) { | ||
| this.purchasePrice = share.getPurchasePrice(); | ||
| this.quantity = share.getQuantity(); | ||
| } | ||
|
|
||
| @Override | ||
| public BigDecimal calculateGross() { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public BigDecimal calculateCommission() { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public BigDecimal calculateTax() { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public BigDecimal calculateTotal() { | ||
| return null; | ||
| } | ||
| } |
34 changes: 33 additions & 1 deletion
34
src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Calculator/SaleCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,36 @@ | ||
| package edu.ntnu.idi.idatt2003.gruppe42.Model.Calculator; | ||
|
|
||
| public class SaleCalculator { | ||
| import edu.ntnu.idi.idatt2003.gruppe42.Model.Share; | ||
| import java.math.BigDecimal; | ||
|
|
||
| public class SaleCalculator implements TransactionCalculator { | ||
| private BigDecimal purchasePrice; | ||
| private BigDecimal salesPrice; | ||
| private BigDecimal quantity; | ||
|
|
||
| public SaleCalculator(Share share) { | ||
| this.purchasePrice = share.getPurchasePrice(); | ||
| this.salesPrice = share.getStock().getSalesPrice(); | ||
| this.quantity = share.getQuantity(); | ||
| } | ||
|
|
||
| @Override | ||
| public BigDecimal calculateGross() { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public BigDecimal calculateCommission() { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public BigDecimal calculateTax() { | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public BigDecimal calculateTotal() { | ||
| return null; | ||
| } | ||
| } |
10 changes: 10 additions & 0 deletions
10
src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Calculator/TransactionCalculator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,14 @@ | ||
| package edu.ntnu.idi.idatt2003.gruppe42.Model.Calculator; | ||
|
|
||
| import java.math.BigDecimal; | ||
|
|
||
| public interface TransactionCalculator { | ||
|
|
||
| BigDecimal calculateGross(); | ||
|
|
||
| BigDecimal calculateCommission(); | ||
|
|
||
| BigDecimal calculateTax(); | ||
|
|
||
| BigDecimal calculateTotal(); | ||
| } |