+ 7

Need a program for loan calculator

For 6 month with 10% interest and input will be the amount

27th Nov 2020, 4:14 PM
samiksha mandhare
samiksha mandhare - avatar
17 ответов
+ 10
Use 90% for 6 months to find the balance. 4 lines of code added. https://code.sololearn.com/cp6GXE4Rc84v/?ref=app If you are paying 10% every month, one way is to find the 10% and then use your total minus the 10% paid to get the balance. The other way, is to find the 90% so you don't have to minus. If you have 100 and you paid 10%, Method 1: 100 - (100 * 10%) = 90 Method 2: 100 * 90% = 90 The "i=0" is used for looping. It will loop from 0 until 5 (< 6), which is 6 times. Finally prints out amount.
30th Nov 2020, 6:02 PM
Lam Wei Li
Lam Wei Li - avatar
+ 4
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); //your code goes here int months = 3; for (int i = 0; i < months; i++) amount = amount * 90 / 100; System.out.println(amount); } }
21st Apr 2021, 2:18 AM
Jose Reinaldo Parra Morales
Jose Reinaldo Parra Morales - avatar
+ 2
Math.ceil was not taught in any of the lesson path. So, how is this part of the solution to the end of unit project ?
1st Feb 2021, 2:27 PM
The Packet Narc
The Packet Narc - avatar
+ 1
samiksha mandhare , this is a code coach task. If you need help show your attempt and if you have problems somebody can help you.
27th Nov 2020, 4:17 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
+ 1
Thank you
28th Nov 2020, 9:47 AM
samiksha mandhare
samiksha mandhare - avatar
+ 1
Lam Wei Li many thanks for your solution, but can you please explain it, why you are using 90% and what is the connection between amount "printed" and the int i?
30th Nov 2020, 7:40 PM
Mohamed Sweify
Mohamed Sweify - avatar
+ 1
Mohamed Sweify, I have edited my original answer to include the explanation.
1st Dec 2020, 3:12 AM
Lam Wei Li
Lam Wei Li - avatar
+ 1
Who can help me with the Loan Calculator answer? I don't understand Anything! I will thank you
21st Mar 2021, 9:34 PM
kensy Nicolle Gutierrez Flores
kensy Nicolle Gutierrez Flores - avatar
0
import java.util.Scanner; public class LoanCalC { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println ("enter the principal amou double amount = sc.nextDouble(); for(int i = 1;i<=6;i++) { System.out.println("Month "+i); System.out.print("Payment 10% of "+amount); amount = amount-amount*0.1; System.out.println(" = "+amount); System.out.println("Remaining amount: "+amount); } } }
27th Nov 2020, 4:23 PM
samiksha mandhare
samiksha mandhare - avatar
0
This is my code
27th Nov 2020, 4:23 PM
samiksha mandhare
samiksha mandhare - avatar
0
Lam Wei Li many thanks for the clarification, have a nice day
1st Dec 2020, 5:52 AM
Mohamed Sweify
Mohamed Sweify - avatar
0
The Packet Narc, My solution didn't involve Math functions. While it's top-voted, unfortunately, it's not marked as the best answer.
1st Feb 2021, 3:19 PM
Lam Wei Li
Lam Wei Li - avatar
0
Easy fast solution
8th Mar 2021, 9:47 PM
AKHY EL MAHEDI
AKHY EL MAHEDI - avatar
0
import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); //your code goes here int months = 3; for (int i = 0; i < months; i++) amount = amount * 90 / 100; System.out.println(amount); } }
11th Dec 2021, 9:13 PM
MN FATHIMA RIHAM - s92064451 -321424451
MN FATHIMA RIHAM - s92064451 -321424451 - avatar
- 1
samiksha mandhare , you need to print just the final amount, remove all other print statements. Also amount should be calculated using Math.ceil method => amount -= Math.ceil (amount *0.1); Finally cast the amount to int => System.out.print ((int) amount) ;
27th Nov 2020, 4:27 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
8th Mar 2021, 9:46 PM
AKHY EL MAHEDI
AKHY EL MAHEDI - avatar
- 1
What's wrong with my code? import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); int result; for(int i = 1; i<=3; i++) { result = amount - amount*(10/100); System.out.println(result); } } }
18th Aug 2021, 3:13 AM
Abhishek Kumar