Lab 2: Control Statements and Loops

Description of the Problem

Develop a Java application that will determine whether any of several department-store customers has exceeded the credit limit on a charge account. For each customer, the following facts are available:

  1. account number
  2. balance at the beginning of the month
  3. total of all items charged by the customer this month
  4. total of all credits applied to the customer’s account this month
  5. allowed credit limit.

The program should input all of these facts as integers, calculate the new balance (= beginning balance + charges – credits), display the new balance and determine whether the new balance exceeds the customer’s credit limit. For those customers whose credit limit is exceeded, the program should display the message "Credit limit exceeded".

Lab Exercise 1

Create a new project in Netbeans using loops that has the following output:

Sample Output

Lab Exercise 1 — Credit 
Enter Account Number (or -1 to quit): 1 Enter Balance: 100
Enter Charges: 80
Enter Credits: 25 
Enter Credit Limit: 200 New balance is 155 
Enter Account Number (or -1 to quit): 2 Enter Balance: 450
Enter Charges: 240
Enter Credits: 300 
Enter Credit Limit: 1000 New balance is 390 
Enter Account Number (or -1 to quit): 3 Enter Balance: 500
Enter Charges: 300
Enter Credits: 125 
Enter Credit Limit: 400 New balance is 675 Credit limit exceeded 
Enter Account Number (or -1 to quit): -1