Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class text {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- double suma = Double.parseDouble(scan.nextLine());
- double mounts = Double.parseDouble(scan.nextLine());
- double simple = suma;
- double complex = suma;
- for (int i = 0; i < mounts; i++) {
- simple = simple + 0.03 * suma;
- complex = complex + 0.027 * complex;
- }
- System.out.printf("Simple interest rate: %.2f lv.%n", simple);
- System.out.printf("Complex interest rate: %.2f lv.%n", complex);
- if (simple > complex) {
- System.out.printf("Choose a simple interest rate. You will win %.2f lv.%n", (simple - complex));
- } else {
- System.out.printf("Choose a complex interest rate. You will win %.2f lv.%n", (complex - simple));
- }
- }
- }
Add Comment
Please, Sign In to add comment