Question

Write a Java application that determines whether any of several department store customers has exceeded the...

Write a Java application that determines whether any of several department store customers has exceeded the credit limit on a charge account. For each customer, the following facts are inputted:

Account number
Balance at beginning of month
Total amount of all items charged by the customer this month
Total amount of all credits applied to the customer’s account this month
Allowed credit limit

Use the value of -1 as a sentinel value to quit the program. The program should input all these facts, 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”.

Use the sentinel control algorithm shown in class and the textbook if you want a passing grade on this lab assignment.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please find the code below:

CreditLimitCheck.java

package classes3;

import java.util.Scanner;

public class CreditLimitCheck {
   public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);

       int accountNumber;
       double balance;
       double charges;
       double credit;
       double creditLimit;
       double newBalance;

       while(true){
           System.out.print("Enter account number : ");
           accountNumber = sc.nextInt();
           if(accountNumber==-1){
               break;
           }

           System.out.print("Enter Balance at beginning of month : ");
           balance = sc.nextDouble();
           if(balance==-1){
               break;
           }

           System.out.print("Enter Total amount of all items charged by the customer this month : ");
           charges = sc.nextDouble();
           if(charges==-1){
               break;
           }

           System.out.print("Enter Total amount of all credits applied to the customer’s account this month : ");
           credit = sc.nextDouble();
           if(credit==-1){
               break;
           }

           System.out.print("Enter Allowed credit limit : ");
           creditLimit = sc.nextDouble();
           if(creditLimit==-1){
               break;
           }

           newBalance = balance+charges-credit;

           if(newBalance>creditLimit){
               System.out.println("Credit Limit Exceeded");
           }
           System.out.println("**********");

       }


   }
}

output:

Add a comment
Know the answer?
Add Answer to:
Write a Java application that determines whether any of several department store customers has exceeded the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a Java application that determines whether any of several department store customers has exceeded the...

    Write a Java application that determines whether any of several department store customers has exceeded the credit limit on a charge account. For each customer, the following facts are inputted: -Balance at beginning of month -Total amount of all items charged by the customer this month -Total amount of all credits applied to the customer’s account this month -Allowed credit limit Use the value of -1 as a sentinel value to quit the program. The program should input all these...

  • i need to Develop a script in java script that will determine whether a department-store customer...

    i need to Develop a script in java script that will determine whether a department-store customer has exceeded the credit limit on a charge account. For each customer, the following facts are available: a) Account number b) Balance at the beginning of the month c) Total of all items charged by this customer this month d) Total of all credits applied to this customer's account this month e) Allowed credit limit The script should input each of these facts from...

  • The code should be written in HTML 5. Thanks! Develop a script that will determine whether...

    The code should be written in HTML 5. Thanks! Develop a script that will determine whether a department-store customer has exceeded the credit limit on a charge account. For each customer, the following facts are available: a) Account number b) Balance at the beginning of the month c) Total of all items charged by this customer this month d) Total of all credits applied to this customer's account this month e) Allowed credit limit The script should input each of...

  • 7.11 Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track...

    7.11 Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of several tankfuls of gasoline by recording the number of miles driven and the number of gallons used for each tankful. Develop a script that will take as input the miles driven and gallons used (both as integers) for each tankful. The script should calculate and output HTML5 text that displays the number of miles per gallon obtained for each tankful and the combined...

  • You work in the IT group of a department store and the latest analytics shows there...

    You work in the IT group of a department store and the latest analytics shows there is a bug that allows customers to go over their credit limit. The company's president has asked you to develop a new algorithm to solve this problem. Create your algorithm using pseudocode that determines if a department store customer has exceeded their credit limit. Be sure you gather the following inputs from the user: Account number Balance of the account Total cost of all...

  • Write a C++ program to manage a credit card company with at least one ADT (Account)...

    Write a C++ program to manage a credit card company with at least one ADT (Account) with the following members: card number, customer name, credit limit, and balance. • The customer can pay the total amount of his/her balance or part of it. • The customer can make a purchase using the credit card. • The user can create, modify, and delete accounts. • All new accounts are created with $300 credit limit. • Customers’ data is stored in a...

  • Write in java language ================== Office Supplies Inc., an office supply store, services many customers. As...

    Write in java language ================== Office Supplies Inc., an office supply store, services many customers. As customers’ orders for office supplies are shipped, information is entered into a file. Office Supplies bills their customers once each month. At the end of each month, the Chief Executive Officer requests a report of all customers sorted by their customer id (from lowest to highest). The report includes their bill balance and tax liability. Write a program to produce the outstanding balance report...

  • Write a complete Java program called "AtmSimDoLoop" (without the quotation marks) according to the following specifications....

    Write a complete Java program called "AtmSimDoLoop" (without the quotation marks) according to the following specifications. It should use a do-while loop to prompt the user with the following starting prompt (without the horizontal lines) until the user enters 4 to quit. The program should start with an initial account balance, which you can set to any legitimate double value. Prompt the user with the following prompt (without the horizontal lines). Enter the number of your desired transaction type. Deposit...

  • Using Java You are helping a corporation create a new system for keeping track of casinos...

    Using Java You are helping a corporation create a new system for keeping track of casinos and customers. The system will be able to record and modify customer and casino information. It will also be able to simulate games in the casino. Customer-specific requirements You can create new customers All new customers have a new customerID assigned to them, starting with 1 for the first, 2 for the second, 3 for the third, ect. New customers have names and monetary...

  • In C++ Create an inheritance hierarchy that a bank might use to represent customers’ bank accounts. All customers at this bank can deposit (i.e., credit) money into their accounts and withdraw (i.e.,...

    In C++ Create an inheritance hierarchy that a bank might use to represent customers’ bank accounts. All customers at this bank can deposit (i.e., credit) money into their accounts and withdraw (i.e., debit) money from their accounts. More specific types of accounts also exist. Savings accounts, for instance, earn interest on the money they hold. Checking accounts, on the other hand, charge a fee per transaction (i.e., credit or debit). Create an inheritance hierarchy containing base class Account and derived...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT