Skip to content

Commit

Permalink
took out default balance
Browse files Browse the repository at this point in the history
  • Loading branch information
awesominat committed Dec 4, 2023
1 parent 1180e68 commit 6d5601d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/entity/CommonUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public CommonUser(
* portfolio and a balance of 10000
*/
public CommonUser() {
this.balance = 10000.0;
this.balance = User.DEFAULT_BALANCE;
this.portfolio = new HashMap<>();
this.history = new HashMap<>();
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.HashMap;

public interface User {
Double DEFAULT_BALANCE = 10000.0;
HashMap<String, TransactionHistory> getHistory();
void addToPortfolio(String ticker, Double amount);
void removeFromPortfolio(String ticker);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import use_case.BaseStockInteractor;

import java.time.LocalDateTime;
import java.util.HashMap;

public class ResetBalanceInteractor extends BaseStockInteractor implements ResetBalanceInputBoundary {
final ResetBalanceDataAccessInterface userDataAccessObject;
Expand Down Expand Up @@ -58,7 +57,7 @@ public void execute(ResetBalanceInputData resetBalanceInputData) {
Boolean resetPressed = resetBalanceInputData.getResetPressed();
User user = userDataAccessObject.get();
Double curBalance = user.getBalance();
Double amountToAdd = 10000.0;
Double amountToAdd = User.DEFAULT_BALANCE;

user.setBalance(amountToAdd);
user.clearPortfolio();
Expand Down

0 comments on commit 6d5601d

Please sign in to comment.