Home / Expert Answers / Computer Science / use-c-and-start-with-an-algorithm-develop-a-c-program-that-will-determine-whether-a-depart-pa234

(Solved): Use C++ and start with an algorithm Develop a C++ program that will determine whether a depart ...



Develop a C++ program that will determine whether a department-store customer has exceeded the credit limit on a charge accou

Use C++ and start with an algorithm

Develop a C++ program 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 (an integer) 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 program should use a while statement to input each of these facts, calculate the new balance (= beginning balance + charges credits) 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 customer's account number, credit limit, new balance, and the message "Credit Limit Exceeded". Enter account number ( -1 to end): 100 Enter beginning balance: 5394.78 Enter total charges: 1000.00 Enter total credits: 500.00 5 Enter credit limit: 5500.00 New balance is 5894.78 Account: 100 Credit limit: 5500.00 Balance: 5894.78 Credit Limit Exceeded. Enter Account Number (or -1 to quit): -1 The output (in this case new balance) should be printed in a floating-point number format and with two digits of precision to the right of the decimal point.


We have an Answer from Expert

View Expert Answer

Expert Answer



Here's an algorithm to solve the problem:
Declare and initialize variables for account number, beginning balance, total charges, total credits, and credit limit.
Prompt the user to enter the account number, beginning balance, total charges, total credits, and credit limit.
Use a while loop to continue prompting for input until the user enters -1 for the account number.
Calculate the new balance by adding the beginning balance, total charges, and total credits.
If the new balance is greater than the credit limit, display the account number, credit limit, new balance, and the message "Credit Limit Exceeded".
Otherwise, display the account number, credit limit, and new balance.
Repeat steps 2-6 for each customer.
End the program.
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe