Você está na página 1de 3

PFE 610S 15 Friday 2019

Lab Exercise 3 217139973

5.1

Program implementing the flowchart


cust_name=input("Enter customer name\n\t") #prompt user to enter the cust_name
tax_code =int(input("Enter the tax \n\t")) #prompt user to enter the tax_code
purch_amnt=int(input("enter purchasing amount\n\t")) #prompt user to enter the
purch_amount

if(tax_code==1): #checks if the tax code is equal to 1


sales_tax=0 #if the condition is true this body will be executed
elif tax_code==2:
sales_tax=purch_amnt*0.02
elif tax_code==3:
sales_tax=purch_amnt*0.05
else:
sales_tax=purch_amnt*0.10
total_amnt =purch_amnt+sales_tax #calculates the total amount
print("\customer name:\t"+cust_name) #prints out a formatted output with a newline and
a tab.
print("\nPurchasing amount:\t",purch_amnt)
print("\nSales tax:\t",sales_tax)
print("\nTotal amount\t",total_amnt)

sample output
5.2

Home mortgage Calculator

Flowchart Algorithm
Start

Read Loan_val,

T
0<Loan_val=<50000 Dep=(5/100)*loan_val

T
5000<Loan_val=<100000 Dep=5000+(loan_val-50000)*0.1

T
1000000<Loan_val=<5000000 Dep=10000+(loan_val-1000000)*0.25

Print invalid
loan value

Print Dep

Stop
Program in Pycharm
loan_val=float(input("Enter Home Loan value\n\t"))
if (0<loan_val)&(loan_val<=50000):
dep=loan_val*0.05
elif (50000<loan_val)&(loan_val<=100000):
dep=5000+(loan_val-50000)
elif (100000<loan_val)&(loan_val<=500000):
dep=10000+(loan_val-10000)*0.25
else :
print("Invalid Loan")
print("The deposit is:\t",dep)

Sample output

Você também pode gostar