0% found this document useful (0 votes)
49 views

PFE 610S 15 Friday 2019 Lab Exercise 3 217139973 5.1 Program Implementing The Flowchart

This document contains code for two programs. The first program implements a flowchart to calculate sales tax and total amount for a customer purchase based on the tax code. It prompts the user for input, uses if/elif statements to determine the correct sales tax rate, and prints outputs. The second program is a home mortgage calculator that uses if/elif statements to determine the required deposit amount based on the loan value entered by the user, or prints an error if the value is invalid.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

PFE 610S 15 Friday 2019 Lab Exercise 3 217139973 5.1 Program Implementing The Flowchart

This document contains code for two programs. The first program implements a flowchart to calculate sales tax and total amount for a customer purchase based on the tax code. It prompts the user for input, uses if/elif statements to determine the correct sales tax rate, and prints outputs. The second program is a home mortgage calculator that uses if/elif statements to determine the required deposit amount based on the loan value entered by the user, or prints an error if the value is invalid.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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

You might also like