Question

In: Computer Science

Develop a python program that will determine if a department store customer has exceeded the credit...

Develop a python program that will determine if a department store customer has exceeded the credit limit on a 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’s account this month and Allowed credit limit. The program should input each of the facts, calculate the new balance (=beginning balance + charges – credits), and determine if the new balance exceeds the customer’s credit limit. For those customers who credit limit is exceeded, the program should display the customer’s account number, credit limit, new balance and the message “Credit limit exceeded”. Here is a sample input/output dialogue: Enter account number (-1 to end): 100 Enter beginning balance: 5394.78 Enter total charges: 1000.00 Enter total credits: 500.00 Enter credit limit: 5500.00 Account: 100 Credit limit: 5500.00 Balance: 5894.78 Credit Limit Exceeded. Enter account number (-1 to end): 200 Enter beginning balance: 1000.00 Enter total charges: 123.45 Enter total credits: 321.00 Enter credit limit: 1500.00 Enter account number (-1 to end): -1 # -1 is terminating condition

Solutions

Expert Solution

Please find below well-commented code in Python.

Note: Make sure to use correct indentation while coding in python. Also, the use of spaces is recommended over tabs.

Code text:

while(True):
accountNumber = int(input("Enter account number(-1 to end): ")) #Get account number from user
if(accountNumber == -1): #Check if account number is -1
break #if yes end the program
  
beginningBalance = float(input("Enter beginning balance: ")) #get beginning balance
  
totalCharges = float(input("Enter total charges: ")) #get charges
  
totalCredit = float(input("Enter total credits: ")) #get credits
  
creditLimit = float(input("Enter credit limit: ")) #get credit limit
  
newBalance = beginningBalance + totalCharges - totalCredit #calculate new balance according to the formula
  
if(newBalance > creditLimit): #check if new balance exceeds credit limti or not
print("Account: " + str(accountNumber))
print("Credit limit: " + str(creditLimit))
print("Balance: " + str(newBalance))
print("Credit Limit Exceeded")

Code image:

Output:


Related Solutions

Develop a python program that will determine if a department store customer has exceeded the credit...
Develop a python program that will determine if a department store customer has exceeded the credit limit on a 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’s account this month  Allowed credit limit The program should input each of the facts, calculate the new balance (=beginning...
A customer has purchased 15 items in a department store.
A customer has purchased 15 items in a department store. Write a code segment to read the unit price and the quantity of each these 15 items and to compute and print its price (which is the unit price times the quantity). Also compute and print average price of the 15 items.
A customer comes into a grocery store and buys 8 items. Write a PYTHON program that...
A customer comes into a grocery store and buys 8 items. Write a PYTHON program that asks for the name of the item and the price of each item, and then displays these on the screen. Refer to the print() and input() statements covered in the module. Do NOT use loops as it will be covered in later modules. Apples 2.10 Hamburger 3.25 Milk 3.49 Sugar 1.99 Bread 1.76 Deli Turkey 7.99 Pickles 3.42 Butter 2.79
Python: Write a program to simulate the purchases in a grocery store. A customer may buy...
Python: Write a program to simulate the purchases in a grocery store. A customer may buy any number of items. So, you should use a while loop. Your program should read an item first and then read the price until you enter a terminal value (‘done’) to end the loop. You should add all the prices inside the loop. Add then a sales tax of 8.75% to the total price. Print a receipt to indicate all the details of the...
A customer comes into a grocery store and buys 8 items.   Write a PYTHON program that...
A customer comes into a grocery store and buys 8 items.   Write a PYTHON program that prompts the user for the name of the item AND the price of each item, and then simply displays whatever the user typed in on the screen nicely formatted.
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 9.9 minutes and a standard deviation of 2.4 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 9.9 minutes and a standard deviation of 2.7 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (a) less than 10 minutes (b) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed, with a mean of 9.1 minutes and a standard deviation of 2.4 minutes. What is the probability that for a randomly chosen customer with a complaint, the amount of time spent resolving the complaint will be as follows. (Round your answers to four decimal places.) (A) less than 10 minutes (B) longer...
The Customer Service Center in a large New York department store has determined that the amount...
The Customer Service Center in a large New York department store has determined that the amount of time spent with a customer about a complaint is normally distributed with a mean of 9.3 minutes and a standard deviation of 2.5 minutes. 1) What is the probability that for a randomly chosen customer with a complaint the amount of time spent resolving the complaint will be less than 12 minutes? Write your answer to four decimal places. 2)  What is the probability...
the customer service center in a large New York department store has determined that the amount...
the customer service center in a large New York department store has determined that the amount of time spent with the customer about a complaint is normally distributed with the mean of 9.3 minutes and a standard deviation of 2.2 minutes what is the probability that 4 randomly chosen customer with the complaint the amount of time spent with solving the complaint will be as follows a less than 10 minutes be longer than 5 minutes see between 8 and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT