Skip to content

Commit 5d7b508

Browse files
committed
Finance Tracker
2 parents 6319618 + a548c63 commit 5d7b508

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

Projects/Finance Tracker/index.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
<meta charset="UTF-8">
66
<meta name="viewport" content="width=device-width, initial-scale=1.0">
77
<link rel="stylesheet" href="styles.css">
8+
<<<<<<< HEAD
89

10+
=======
11+
12+
>>>>>>> a548c639afa0f1ac1cdb441c63180145b7acef31
913

1014
<title>Personal Finance Tracker</title>
1115
</head>
@@ -62,11 +66,22 @@ <h2>Transaction History</h2>
6266
<p id="noTransactionMessage">No transactions yet.</p>
6367
</section>
6468
<section id="bottom"></section>
69+
<<<<<<< HEAD
6570

6671
</main>
6772

6873
<script src="index.js"></script>
6974

7075
</body>
7176

72-
</html>
77+
</html>
78+
=======
79+
80+
</main>
81+
82+
<script src="index.js"></script>
83+
84+
</body>
85+
86+
</html>
87+
>>>>>>> a548c639afa0f1ac1cdb441c63180145b7acef31

Projects/Finance Tracker/index.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function updateBalance() {
2525
const balance = transactions.reduce((acc, transaction) => {
2626
return transaction.type === "income" ? acc + transaction.amount : acc - transaction.amount;
2727
}, 0);
28+
<<<<<<< HEAD
2829

2930
totalIncome = transactions.reduce((acc, transaction) => {
3031
return transaction.type === "income" ? acc + transaction.amount : acc;
@@ -34,6 +35,17 @@ function updateBalance() {
3435
return transaction.type === "expense" ? acc + transaction.amount : acc;
3536
}, 0);
3637

38+
=======
39+
40+
totalIncome = transactions.reduce((acc, transaction) => {
41+
return transaction.type === "income" ? acc + transaction.amount : acc;
42+
}, 0);
43+
44+
totalExpense = transactions.reduce((acc, transaction) => {
45+
return transaction.type === "expense" ? acc + transaction.amount : acc;
46+
}, 0);
47+
48+
>>>>>>> a548c639afa0f1ac1cdb441c63180145b7acef31
3749
balanceAmount.textContent = balance.toFixed(2);
3850
incomeAmount.textContent = totalIncome.toFixed(2);
3951
expenseAmount.textContent = totalExpense.toFixed(2);
@@ -53,8 +65,13 @@ function addTransaction(event) {
5365
amount,
5466
type
5567
};
68+
<<<<<<< HEAD
5669

5770

71+
=======
72+
73+
74+
>>>>>>> a548c639afa0f1ac1cdb441c63180145b7acef31
5875
transactions.push(transaction);
5976
if(type==="income"){
6077
totalIncome+=amount;
@@ -84,7 +101,11 @@ function deleteTransaction(index) {
84101
updateTransactions();
85102
updateBalance();
86103
saveTransactions();
104+
<<<<<<< HEAD
87105

106+
=======
107+
108+
>>>>>>> a548c639afa0f1ac1cdb441c63180145b7acef31
88109
}
89110

90111
// Function to save transactions to Local Storage
@@ -138,21 +159,33 @@ function editTransaction(index) {
138159
amount: updatedAmount,
139160
type: updatedType
140161
};
162+
<<<<<<< HEAD
141163

164+
=======
165+
166+
>>>>>>> a548c639afa0f1ac1cdb441c63180145b7acef31
142167
if (transaction.type === "income") {
143168
totalIncome -= transaction.amount;
144169
totalIncome += updatedAmount;
145170
} else if (transaction.type === "expense") {
146171
totalExpense -= transaction.amount;
147172
totalExpense += updatedAmount;
148173
}
174+
<<<<<<< HEAD
149175

176+
=======
177+
178+
>>>>>>> a548c639afa0f1ac1cdb441c63180145b7acef31
150179
transactions[index] = updatedTransaction;
151180
alert(`Transaction "${updatedTransaction.description}" updated successfully!`);
152181
updateTransactions();
153182
updateBalance();
154183
saveTransactions();
184+
<<<<<<< HEAD
155185

186+
=======
187+
188+
>>>>>>> a548c639afa0f1ac1cdb441c63180145b7acef31
156189
} else {
157190
alert("Invalid input! Please try again.");
158191
}

0 commit comments

Comments
 (0)