Write a program that will make use of a class called Credit to determine if a department store customer has exceeded the credit limit on charge account for each customer, the following facts are available
Account Number
Balance at the beginning of the month.
Total of all items charged by this customer this month.
Total of all credits applied to this customer account this month
Credit Limit.
The program should input each of those facts, calculate balance (= beginning balance + charges credits) and determine if the new balance exceeds the customers credit limit. For those customers whose credit limit is exceeded the program should display the message Credit Limit Exceeded otherwise the message Within the credit limit should be displayed. The program should include a loop that lets the user repeat this calculation until he or she is thr
import java.util.Scanner;
public class Credit {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.print("Enter account number ");
int accNumb = scan.nextInt();
System.out.print("Enter balance at the beginning of the month ");
int balance = scan.nextInt();
System.out.print("Enter total of all items charged by this customer this month ");
int total= scan.nextInt();
System.out.print("Enter total of all credits applied to this customer account this month" );
int total2=scan.nextInt();
System.out.print("Enter credit limit ");
int lim=scan.nextInt();
int balance1=balance+total2;
while (balance1<lim) {
System.out.print("\nCredit Limit Exceeded,enter credit limit again ");
lim=scan.nextInt();
}
System.out.println("Within the credit limit");
}
}
Comments
Leave a comment