Advertisement
Guest User

Final part 2

a guest
Dec 12th, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. public static void main(String args[]){
  2. Scanner bucky = new Scanner(System.in);
  3. double fnum, snum, answer;
  4. System.out.println("Enter first num: ");
  5. fnum = bucky.nextDouble();
  6. System.out.println("Enter Second num: ");
  7. snum = bucky.nextDouble();
  8. answer = fnum + snum;
  9. System.out.println(answer+" Added");
  10. answer = fnum - snum;
  11. System.out.println(answer+ " Subtracted");
  12. answer = fnum * snum;
  13. System.out.println(answer+ " Multiplied");
  14. answer = fnum / snum;
  15. System.out.println(answer+ " Divided");
  16. CompoundInterest();
  17. }
  18.  
  19. public static double CompoundInterest() {
  20. System.out.println("Type the principal");
  21. double p = scan.nextDouble();
  22. System.out.println("Type the interest rate");
  23. double r = scan.nextDouble();
  24. System.out.println("Type how often the interest in compounded");
  25. double n = scan.nextDouble();
  26. System.out.println("Type the time");
  27. double t = scan.nextDouble();
  28.  
  29. double part1 = (p * (1 + (r / n)));
  30. double part2 = (n * t);
  31. double A = Math.pow(part1, part2);
  32. return A;
  33. A = p*r*t/100
  34. System.out.print("the simple interest is :" + A);
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement