Thursday, December 21, 2023
montage calculator
import tkinter as tk
from tkinter import messagebox
def calculate():
try:
amount = float(entry_amount.get())
years = int(entry_years.get())
interest_rate = float(entry_interest_rate.get()) / 100
total = amount * (1 + interest_rate * years)
messagebox.showinfo("ISA Calculator", f"Your ISA will be worth £{total:.2f} after {years} years.")
except ValueError:
messagebox.showerror("Error", "Please enter valid numbers.")
# Create the main window
root = tk.Tk()
root.title("ISA Calculator")
# Create labels
label_amount = tk.Label(root, text="Initial Amount:")
label_years = tk.Label(root, text="Number of Years:")
label_interest_rate = tk.Label(root, text="Interest Rate (%):")
label_amount.grid(row=0, column=0, padx=10, pady=5, sticky=tk.E)
label_years.grid(row=1, column=0, padx=10, pady=5, sticky=tk.E)
label_interest_rate.grid(row=2, column=0, padx=10, pady=5, sticky=tk.E)
# Create entry boxes
entry_amount = tk.Entry(root)
entry_years = tk.Entry(root)
entry_interest_rate = tk.Entry(root)
entry_amount.grid(row=0, column=1, padx=10, pady=5)
entry_years.grid(row=1, column=1, padx=10, pady=5)
entry_interest_rate.grid(row=2, column=1, padx=10, pady=5)
# Create calculate button
calculate_button = tk.Button(root, text="Calculate", command=calculate)
calculate_button.grid(row=3, columnspan=2, padx=10, pady=10)
# Run the main loop
root.mainloop()
function calculateMortgage() {
var loanAmount = parseFloat(document.getElementById('loanAmount').value);
var interestRate = parseFloat(document.getElementById('interestRate').value) / 100 / 12;
var loanTerm = parseFloat(document.getElementById('loanTerm').value) * 12;
var monthlyPayment = (loanAmount * interestRate) / (1 - Math.pow(1 + interestRate, -loanTerm));
var totalPayment = monthlyPayment * loanTerm;
var totalInterest = totalPayment - loanAmount;
displayResults(monthlyPayment, totalPayment, totalInterest);
}
function displayResults(monthlyPayment, totalPayment, totalInterest) {
var monthlyPaymentElement = document.getElementById('monthlyPayment');
var totalPaymentElement = document.getElementById('totalPayment');
var totalInterestElement = document.getElementById('totalInterest');
monthlyPaymentElement.textContent = 'Monthly Payment: $' + monthlyPayment.toFixed(2);
totalPaymentElement.textContent = 'Total Payment: $' + totalPayment.toFixed(2);
totalInterestElement.textContent = 'Total Interest: $' + totalInterest.toFixed(2);
}
Subscribe to:
Post Comments (Atom)
screan recoder
Screen Recorder Screen Recorder Tool Start Recording Stop Recording...
-
import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servl...
-
Screen Recorder Screen Recorder Tool Start Recording Stop Recording...
-
import random class ArticleGenerator: def __init__(self): self.templates = [ "The {adj1} {noun} {verb} over th...
No comments:
Post a Comment