-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCredit.java
53 lines (35 loc) · 1.22 KB
/
Credit.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import java.util.Scanner;
public class Credit{
public static void main(String[]args) {
int accountNum;
int beginningBalance;
int charge;
int totalCreditsApplied;
int creditLimit;
int newBalance;
int continueOrNot;
continueOrNot=1;
Scanner input=new Scanner(System.in);
while (continueOrNot==1) {
System.out.println("Enter the account number");
accountNum=input.nextInt();
System.out.println("Enter the balance at the beginning of the month");
beginningBalance=input.nextInt();
System.out.println("Enter the total of all items charged by the customer this month");
charge=input.nextInt();
System.out.println("Enter the total of all credits applied to the customer’s account this month");
totalCreditsApplied=input.nextInt();
System.out.println("Enter the allowed credit limit");
creditLimit=input.nextInt();
newBalance=beginningBalance+charge-totalCreditsApplied;
if (newBalance>creditLimit) {
System.out.println("Credit limit exceeded lol");
}
else {
System.out.println("Credit limit not exceeded");
}
System.out.println("Enter 1 to continue, enter another number to stop");
continueOrNot=input.nextInt();
}
}
}