1. Engineering
  2. Computer Science
  3. hello i have an assignment due and i cant get...

Question: hello i have an assignment due and i cant get...

Question details

Hello, I have an assignment due and I cant get eclipse to work on my computer. I just get errors everytime I try to run the installer or when I try to open it using the directly downloaded files. Anyway I needed some help with this program. I created this in notepad I just need someone to run it for me and if it works let me know or if it doesnt help me fix it. This is programmed in java. The assignment is in the picture below and my code will follow. Thank you very much.

Write a Java program to calculate the amount of money deposited in a bank using simple interest. The user will enter the initial amount and the number of years. The interest rate 4.25%. The program should print the final amount in a standard format EX: A deposit of $$$ at 4.25% for nn years will produce a sum of $$$$$$$$$.

* This program calculates the simple interest of a deposit

import javax.swing.JOptionPane;
public class Interest {

   public static void main(String[] args) {
       // Define Variables
       double I,P,R,T,A;
       R = .0425;
       // Get the amount of money and the time period in years from the user
       String P_Text = JOptionPane.showInputDialog("Enter the amount of money that you deposited: ");
       P = Double.parseDouble(P_Text);
       String T_Text = JOptionPane.showInputDialog("Enter how many years your money will be in the bank: ");
       T = Double.parseDouble(T_Text);
       // Calculations for interest rate and total amount
       I = P * R * T;
       A = P + I;
       // Display the results
       System.out.println("If you deposit " + P + " at 4.25% for " + T + " you will have a sum of" + A + " in the bank.");

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution