The Loan Calc problem in Java | Sololearn: Learn to code for FREE!

+1

The Loan Calc problem in Java

Hi everyone, I have been trying to solve this loan calc problem for Java. It is for the loops section. Not sure what am I missing here. The hidden test cases fail and. I am unable to complete my certificate since this problem is not solved. Please let me know if any of you faced it also and how did you get it resolved. import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); int i = 0; //your code goes here if (amount > 0){ while( i <3){ amount = amount - (amount/100 * 10); i++; } System.out.println(amount); } } }

4/13/2021 5:21:50 AM

Sapna Singh

6 Answers

New Answer

+3

Hope this helps you

+2

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int amount = scanner.nextInt(); int loan; //your code goes here for(int i=1;i<=3;i++) { loan =amount/10; amount-=loan; } System.out.println(amount); } }

+1

https://www.sololearn.com/discuss/2604391/?ref=app https://www.sololearn.com/discuss/2681400/?ref=app https://www.sololearn.com/discuss/2680282/?ref=app https://www.sololearn.com/discuss/2660363/?ref=app https://www.sololearn.com/discuss/2737889/?ref=app https://www.sololearn.com/discuss/2670258/?ref=app https://www.sololearn.com/discuss/2610459/?ref=app https://www.sololearn.com/discuss/2605192/?ref=app

+1

thank you

+1

import java.util.Scanner; public class Program { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int amount = sc.nextInt(); for(int months =6; months>0; months--) { amount = amount*90/100; } System.out.println(amount); } } Hope this helps you.... :-)☺☺☺

0

I have this code so far and I'm trying to figure out how to do the following. Right now I just have a basic calculator that will ask for the car price and then a down-payment amount and from there calculate loan-related stuff based on that sum. The loan is a static 4 year 8% loan right now. As you can see, I have began putting code in to ask if the user wants to pay a little bit extra each month to pay off the loan early. I think what I have so far is right...I'm terrible with these loan formulas. I am trying to figure out how I would go about calculating how many months early the loan would be paid off based upon the amount the user enters when the program asks how much they would like to pay extra. https://www.rapidfs.me/