Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Assignment 58h
- *
- * Cody O
- * 9/14/19
- */
- import java.util.*;
- import java.lang.*;
- import java.text.*;
- public class Program_58h_CodyO
- {
- public static void main (String[]args)
- {
- NumberFormat money = NumberFormat.getCurrencyInstance();
- Scanner input = new Scanner(System.in);
- DecimalFormat fmt = new DecimalFormat("#");
- //input
- System.out.println("Amount Saved ");
- double savedA = input.nextInt();
- System.out.println("Interest rate?");
- double rateA = input.nextDouble();
- System.out.println("Number of times compounded per year?");
- double amountA = input.nextInt();
- System.out.println("Numbers of days at interest?");
- double daysA = input.nextInt();
- //math
- double topA = .01 * rateA;
- double outsideA = (amountA * daysA) / 365.000;
- double insideA = 1 + (topA / amountA);
- double lastA = savedA * (Math.pow(insideA, outsideA));
- //output
- System.out.println(" ");
- System.out.println("The interest earned is " + money.format(lastA - savedA));
- System.out.println("The total amount in savings is now " + money.format(lastA));
- //input
- System.out.println("Amount Saved ");
- double savedB = input.nextInt();
- System.out.println("Interest rate?");
- double rateB = input.nextDouble();
- System.out.println("Number of times compounded per year?");
- double amountB = input.nextInt();
- System.out.println("Numbers of days at interest?");
- double daysB = input.nextInt();
- //math
- double topB = .01 * rateB;
- double outsideB = (amountB * daysB) / 365.000;
- double insideB = 1 + (topB / amountB);
- double lastB = savedB * (Math.pow(insideB, outsideB));
- //output
- System.out.println(" ");
- System.out.println("The interest earned is " + money.format(lastB - savedB));
- System.out.println("The total amount in savings is now " + money.format(lastB));
- //input
- System.out.println("Amount Saved ");
- double savedC = input.nextInt();
- System.out.println("Interest rate?");
- double rateC = input.nextDouble();
- System.out.println("Number of times compounded per year?");
- double amountC = input.nextInt();
- System.out.println("Numbers of days at interest?");
- double daysC = input.nextInt();
- //math
- double topC = .01 * rateC;
- double outsideC = (amountC * daysC) / 365.000;
- double insideC = 1 + (topC / amountC);
- double lastC = savedC * (Math.pow(insideC, outsideC));
- //output
- System.out.println(" ");
- System.out.println("The interest earned is " + money.format(lastC - savedC));
- System.out.println("The total amount in savings is now " + money.format(lastC));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement