All pastes #732273 Raw Edit

Anonymous

public java v1 · immutable
·published 2007-10-10 20:31 UTC
rendered paste body
import javax.swing.JOptionPane;import java.lang.Double;import java.text.DecimalFormat;public class UseBankInterest {	public static void main (String[] args) {		int Years = 0;		double Deposit = 0;		double Interest = 0;		double Result;		int CalculationNumber = 1;		int ProgramChoice = 0;		Object[] ProgramOptions = {"New Calculation", "Show Results"};		double CalculatedDeposithGrowth = 0;		JOptionPane.showMessageDialog(null,"Program: BankInterest\n\nThis program calculates the deposit (D) growth over X years\nwith Y percent interest, using the forumla:\n\n"+ "            " + "Deposit*(1+(Interest/100)^Years");		do {		 String inputDeposit = JOptionPane.showInputDialog("Calculation #"+CalculationNumber+"\n"+"How much was deposited? (in USD): ");		 	Double.parseDouble(inputDeposit);		 String inputInterest = JOptionPane.showInputDialog("Calculation #"+CalculationNumber+"\n"+"How high is the interest? (in percent): ");		 	Double.parseDouble(inputInterest);		 String inputYears =  JOptionPane.showInputDialog("Calculation #"+CalculationNumber+"\n"+"For how many years?: ");		 	Integer.parseInt(inputYears);		BankInterest growth1 = new BankInterest();		CalculatedDeposithGrowth = CalculatedDeposithGrowth + growth1.CalculateGrowth(Deposit, Interest, Years);		 CalculationNumber = CalculationNumber + 1;		 ProgramChoice = JOptionPane.showOptionDialog(null, "How do you want to continue?", "How do you want to continue?", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE,null, ProgramOptions, ProgramOptions[0]);		} while (ProgramChoice == 0);		if (ProgramChoice == 1) {			Result = CalculatedDeposithGrowth;			System.out.println(Result);		}	}}