// This is the Debts program in Java
import java.io.*;
class Debts {
public static void main(String[] args) throws IOException{
BufferedReader stdin=new BufferedReader(new InputStreamReader(System.in));
String Amount, Payable, Interest, Paid;
double Value, Rate, Spent; int Years;
System.out.print("Enter Amount: ");
Amount=stdin.readLine();
Value=Double.parseDouble(Amount);
System.out.print("Enter Payable in years: ");
Payable=stdin.readLine();
Years=Integer.parseInt(Payable);
System.out.print("Enter Intrest Rate: ");
Interest=stdin.readLine();
Rate=Double.parseDouble(Amount);
for (int i = 1; i <=Years; i = i+1) {
System.out.println("year"+ i + " paid: ");
Paid=stdin.readLine();
Spent=Double.parseDouble(Paid);
}
if(Spent>Amount)
System.out.println("lo"); // Finish the line
}
}
Scenario: I already have the for loop there running but my problem is this... for example I tried to enter 5000 then payable in years(this was the for loop... the payable in years) rate is in 5% then i want to do the checking if(Spent> Amount) but the problem can I total all the values I inputed in the for loop???
If it can pls Help me.