-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFinanceTracker.java
More file actions
40 lines (25 loc) · 895 Bytes
/
Copy pathFinanceTracker.java
File metadata and controls
40 lines (25 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
hhhhhhhhyh
import java.util.*;
import java.time.*;
import java.text.DecimalFormat;
public class FinanceTracker {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ArrayList<Double> expenseList = new ArrayList<>();
//Creating an array to store values dynamically.
double dailylimit = 50.0;
HashMap<LocalDate, expenselist> expenses = new HashMap<>();
LocalDate today = LocalDate.now();
expenses.put(today, 0.0);
double TodayTotal = expenses.get(today);
double newExpense = 60.0;
TodayTotal += newExpense;
for(double expense: expenseList) {
TodayTotal += expense
}
if (TodayTotal > dailylimit) {
double overlimit = TodayTotal - dailylimit;
System.out.printf("You've just gone over your limit by %.2f.\n Make sure to be careful next time!", overlimit);
}
}
}