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