Results 1 to 2 of 2
  1. #1
    phoenixblue is offline Member
    Join Date
    Nov 2012
    Rep Power

    Default Help with Java program (Loops)

    I've been asked to:

    "Consider the scenario where someone puts an amount of money into a savings account. At the end of each year, the savings account pays interest at a rate of 3%, but also deducts a £10 administration fee. Write a program called to calculate how much money will be in the account after a certain number of years. Use a loop to perform the calculation. The user should enter the initial amount of money and the number of years. You should assume that the user does not add any more money to the account after the initial amount. "

    And I am currently struggling, i'm not sure how i could write code which increases the value of saving by 3% for each year. My code is below, any help is appreciated

    Java Code:
    import javax.swing.JOptionPane;
    public class Saving
      public static void main(String[] args)
        String m = JOptionPane.showInputDialog("Enter the initial amount of money in your savings account:");
        double money = Double.parseDouble(m);
        String y = JOptionPane.showInputDialog("Amount of years the money will be saved for:");
        int years = Integer.parseInt(y);
               money = (money * 1.03)
               //To be done equal to the amount of years 
        money - (-10 * years)
        JOptionPane.showMessageDialog(null, "After:" + years "years" + "your savings will be worth " + money");

  2. #2
    JBelg is offline Member
    Join Date
    Oct 2012
    Rep Power

Similar Threads

  1. Having difficulty executing a series of loops in program
    By serenityN0W in forum New To Java
    Replies: 16
    Last Post: 07-28-2011, 01:54 PM
  2. How do I scroll using loops in a program?
    By joes in forum New To Java
    Replies: 1
    Last Post: 02-18-2011, 12:11 PM
  3. HELP - Creating OPTIONS in program and LOOPS
    By whateverme in forum New To Java
    Replies: 14
    Last Post: 12-07-2010, 05:55 AM
  4. Replies: 2
    Last Post: 02-23-2009, 02:18 AM
  5. Help combining loops into 1 program.
    By kewlgeye in forum New To Java
    Replies: 5
    Last Post: 04-22-2008, 09:58 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts