Internet Programming, Python Create two Python scripts that will print out infor
ID: 3677676 • Letter: I
Question
Internet Programming, Python
Create two Python scripts that will print out information from the Classic Models database.
The first script will list all customers with the following information:
Customer number
Customer name
Total of payments made
Total value of all orders made
Credit limit
Amount of available credit (credit limit plus the total payments made minus the total value of all orders made)
The list should be in a tabular format with data lined up in columns.
The second script will list the same information but will just list those customers who have exceeded their credit limit. That is, list customers for whom the total of the credit limit and the total payments made is less than the total value of orders made.
When tested, the script will be run with the file classic_models.sqlite in the script directory.
The page customer-list.html displays the information. NOTE! you will be creating a table in pure text. The web page was just the most convenient way to provide some data you could compare against.
Resources:
http://ksuweb.kennesaw.edu/~bsetzer/4720sp16/nanoc/output/assignments/makeup/2/
customer-list.html: http://ksuweb.kennesaw.edu/~bsetzer/4720sp16/nanoc/output/assignments/birt-sample/customer-list.html
Explanation / Answer
# comments in python
def functionName1():
defFunctionName2():
def printData():
count = 500
# around 500 customers considered
stage = 1
# steps of the loop - for loop
for i in range(1,count,stage):
print(i, i)
print (CustomerNumber)
print (CustomerName)
print(TotalPaymentsMade)
print(TotalValueOrder)
print(CreditLimit)
print(AvailableCreditAmount)
def printExceedingCredit():
# test for those customers with credit limit exceeded
# declare variable credit limit
# check with the existing variable limit
credit = read from data base
limit 2000
difference1 = 0
# a credit limit of $ 2000
for i in range (1,count, stage):
if credit > limit:
# list out all customers who had exceeded the credit limit
print(CustomerName)
print("Limit Exceeded by an amoun of")
# list the difference between the credit and the limit
# for example, if a customer erached $2100 then the difference is $100 as the limit is $ 2000
difference1 = credit - limit
# end of if
# end for
# comments in python
def functionName1():
defFunctionName2():
def printData():
print (CustomerNumber)
print (CustomerName)
print(TotalPaymentsMade)
print(TotalValueOrder)
print(CreditLimit)
print(AvailableCreditAmount)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.