Задача Account Balance
Къде ми е грешката?Благодаря предварително.
Код:
import java.util.Scanner;
public class AccountBalance {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int n = Integer.parseInt(scanner.nextLine());
int counter = 0;
double balance = 0.0;
while (counter < n){
double amount = Double.parseDouble(scanner.nextLine());
if (amount < 0) { //TODO: Print output and exit the loop}
balance += amount;
System.out.printf("Increase: %.2f", amount);
counter++;
}
}
}
System.out.printf("Total: %.2f", balance);
Получи се.Благодаря ти отново:):):)