luoni

rate

Jun 27th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class text {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. Scanner scan = new Scanner(System.in);
  8.  
  9. double suma = Double.parseDouble(scan.nextLine());
  10. double mounts = Double.parseDouble(scan.nextLine());
  11. double simple = suma;
  12. double complex = suma;
  13.  
  14. for (int i = 0; i < mounts; i++) {
  15.  
  16. simple = simple + 0.03 * suma;
  17. complex = complex + 0.027 * complex;
  18. }
  19. System.out.printf("Simple interest rate: %.2f lv.%n", simple);
  20. System.out.printf("Complex interest rate: %.2f lv.%n", complex);
  21. if (simple > complex) {
  22. System.out.printf("Choose a simple interest rate. You will win %.2f lv.%n", (simple - complex));
  23. } else {
  24. System.out.printf("Choose a complex interest rate. You will win %.2f lv.%n", (complex - simple));
  25. }
  26.  
  27. }
  28. }
Add Comment
Please, Sign In to add comment