Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- /**
- * Write a description of class Project2 here.
- * Kailey McNeal
- * 10-2-14
- * Project #2
- */
- public class Project2
- {
- public static void main (String[] args)
- {
- Scanner console=new Scanner (System.in);
- System.out.print("Interest Rate: ");
- double percent=console.nextDouble();
- System.out.print("Initial Deposit: ");
- double initial=console.nextDouble();
- System.out.print("Time(Years) : ");
- int years=console.nextInt();
- System.out.print("New Deposit: ");
- double extra=console.nextDouble();
- header();
- for (int i=1; i<=years; i++) //year
- {
- double rate=(percent/100);
- double interest = (initial*rate);
- interest=(Math.round(interest*100))/100;
- double balance=interest + initial;
- balance=Math.round(balance*100)/100;
- double newbalance=balance+extra;
- System.out.println("|\t" + i + "\t|\t" + initial + "\t|\t" + interest + "\t|\t" + balance + "\t|\t" + extra + "\t|" + "\t|\t" + newbalance + "\t|");
- initial=newbalance;
- }
- }
- public static void header()
- {
- System.out.println("|\tYears\t|\tDeposit|\tInterest|\tBalance|\tExtra Deposit\t|\tNew Balance\t|");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement