Answer to Question #316261 in Java | JSP | JSF for Jay

Question #316261

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

1
Expert's answer
2022-03-23T02:58:12-0400
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");
        }
    }

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS