Я все еще новичок в программировании, поэтому мне нужно учиться у вас в этом вопросе.
Спасибо!
Вот проблема, для которой я должен написать код:
Код: Выделить всё
Make a simple checkbook balancer that would input a sequence of
deposits (positive floating-point values) and
issuances (negative floating-point values) terminated by a 0.
It would output the transaction type, the amount and the running balance for each entry.
Assume the initial balance of 0. Ensure that the issued check won’t bounce!
Код: Выделить всё
import java.util.*;
import java.lang.*;
public class Checkbook{
public static void main (String[]args){
Scanner input = new Scanner(System.in);
float bal=0, amt=0;
char reply;
do{
System.out.print("Input Amount: ");
amt=input.nextInt();
if(amt>0){
bal+=amt;
System.out.print("\nAmount: " +amt);
System.out.print("\nTransaction Line: Deposit");
System.out.print("\nRunning Balance: " +bal);
;
}
else if(amt
Подробнее здесь: [url]https://stackoverflow.com/questions/69344135/java-checkbook-balancer[/url]
Мобильная версия