- 1
Help!!! Java
i need help with java exercise, loan calculator
7 Respuestas
+ 2
No I am asking you to show your code which you tried
+ 1
Please post what you have tried
+ 1
double amount = scanner.nextInt();
for (int x=1; x<=6; x++) {
amount -= (Math.ceil(amount/10));
}
System.out.println((int)amount);
}
}
These are some necessary changes that you should bring in your code
0
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int amount = scanner.nextInt();
//tu código va aquí
for (int x=1; x<=6; x++)
{
amount= amount * 10 / 100;
System.out.println(amount);
}
}
}
0
thank’s
0
In this exercise, instead of working with int, it's better to work with double or float
- 1
You ask a friend for a loan and need to calculate how much you will owe him after 6 months.
You are going to pay him back 10% of the remaining loan amount each month.
Create a program that takes the loan amount as input, calculates and generates the remaining amount after 6 months.
Input example:
20000
Output example:
10628
Here is the monthly payment schedule:
Month 1
Payout: 10% of 20000 = 2000
Quantity Remaining: 18000
Month 2
Payment: 10% of 18000 = 1800
Quantity Remaining: 16200
Month 3:
Payout: 10% of 16200 = 1620
Quantity Remaining: 14580
Month 4:
Payout: 10% of 14580 = 1458
Quantity Remaining: 13122
Month 5:
Payment: 10% of 13122 = 1313
Quantity Remaining: 11809
Month 6:
Payment: 10% of 11809 = 1181
Amount Remaining: 10628 Use a loop to calculate your payment and the amounts remaining for each month.
Also, use whole numbers for quantities.