Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added file under web Development #67

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions Web_Development/Finance Manager/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Personal Finance Manager</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="container">
<h1>Personal Finance Manager</h1>
<div class="form-group">
<input type="text" id="expense-name" placeholder="Expense Name">
<input type="number" id="expense-amount" placeholder="Amount">
<button onclick="addExpense()">Add Expense</button>
</div>
<div class="expenses">
<h2>Expenses</h2>
<ul id="expense-list"></ul>
</div>
</div>
<script src="script.js"></script>
</body>
</html>
26 changes: 26 additions & 0 deletions Web_Development/Finance Manager/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
let expenses = [];

function addExpense() {
const name = document.getElementById('expense-name').value;
const amount = document.getElementById('expense-amount').value;

if (name && amount) {
expenses.push({ name, amount: parseFloat(amount) });
document.getElementById('expense-name').value = '';
document.getElementById('expense-amount').value = '';
renderExpenses();
} else {
alert('Please enter both name and amount');
}
}

function renderExpenses() {
const expenseList = document.getElementById('expense-list');
expenseList.innerHTML = '';

expenses.forEach(expense => {
const li = document.createElement('li');
li.innerHTML = `${expense.name} - $${expense.amount.toFixed(2)}`;
expenseList.appendChild(li);
});
}
71 changes: 71 additions & 0 deletions Web_Development/Finance Manager/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}

.container {
background-color: #fff;
padding: 20px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 8px;
width: 300px;
text-align: center;
}

h1 {
margin-bottom: 20px;
}

.form-group {
margin-bottom: 20px;
}

input[type="text"], input[type="number"] {
width: calc(100% - 22px);
padding: 10px;
margin-bottom: 10px;
border: 1px solid #ddd;
border-radius: 4px;
}

button {
padding: 10px 20px;
background-color: #28a745;
border: none;
color: white;
border-radius: 4px;
cursor: pointer;
}

button:hover {
background-color: #218838;
}

.expenses {
text-align: left;
}

.expenses h2 {
margin-top: 0;
}

ul {
list-style-type: none;
padding: 0;
}

li {
background-color: #f9f9f9;
margin-bottom: 10px;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
display: flex;
justify-content: space-between;
}