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

Programming Logic Portfolio

This document is a portfolio of the Programming Logic subject of student Carlos Rivera. Contains tasks, presentations and exercises on propositions, truth tables, methods, conditions, conversions and Python programming. The portfolio includes 13 Python programs that solve problems such as calculating prices, averaging, depreciation, cafeteria payments, and more.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

Programming Logic Portfolio

This document is a portfolio of the Programming Logic subject of student Carlos Rivera. Contains tasks, presentations and exercises on propositions, truth tables, methods, conditions, conversions and Python programming. The portfolio includes 13 Python programs that solve problems such as calculating prices, averaging, depreciation, cafeteria payments, and more.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Briefcase

Week: 10

Student name:
Carlos Rivera

Programmation logic
Study location:
UNITEC, Tegucigalpa

Teacher:
Arleth Moncada

Section:
284

Date of delivery:
March 27, 2022
Index
Task 2 Truth Tables
Task 3 Methods
Task 4 Assignments
Task 1 Propositions
Task 5 Conditions
Conversions Presentation
Conversions Exercises
Task 1 Python
python 4
Python 5
Task 1 Python
Python 6
python 7
Python 8
Python 9
Python 10
Python 11
Python 12
Python 13
Final Project Statement
Preview 1
Final project
Task 1 Propositions
Task 2 Truth Tables
Task 3 Methods
Task 4 Assignments
Task 5 Conditions
Conversion Presentation

cblackboard

Review delivery history: Presentation Conversions


* 284 TGU I PROGRAMMING
LOGIC
2022
instructions for activity V

QUALIFY

INTENT
2.00

CAREONATICO sesMcuSAHEI nDesimal • Octalopts


Decimal to Conversion
Octal
Comment to the student

MEMBERS
Bin tatao with the aMgnación

TEGUOGAOK wowounas tMM (


Yo____________2022._____________1

-• Introduction

G0e•d• v272022 e
Conversions Exercises
Task1 Python
# -*- coding: utf-8 -*-"""Created on Mon Feb 21 22:36:07 2022@author: Carlos Andres
Riveraccount: 11941225"""UCost= float(input("Unit Cost of a product: ") )Units=
float(input("Number of Units of a product: "))PriceV=
CostU+CostU*0.40TotalP= PriceV*Unitsprint("Sales Price of the product is: ",
round(PriceV,2))print("Total to pay for the requested units is: ", round(TotalP,2)
Task4 Python
# -*- coding: utf-8 -*-"""Created on Wed Feb 23 09:39:28 2022The name and 5 grades of a
student are given as data, the name, average and the word “PASS” must be printed if the
student has an average greater than or equal to 60 and the expression “NOT APPROVED”
otherwise.@author: Carlos Rivera account: 11941225"""name = input("student name: ")c1
= float(input("first student's grade: "))c2 = float(input("student's second grade: "))c3 =
float(input("student's third grade: "))c4 = float(input("student's fourth grade: ")) ))c5 =
float(input("student's fifth grade: "))average = (c1+c2+c3+c4+c5)/5if average>=60:
expression = "passed"else: expression = "not approved"
print("###########")print("student name: ", name)print("student's average is:
",round(average,2))print(expression)print( "###########
Task5 Python
# -*- coding: utf-8 -*-"""Created on Thu Feb 24 09:08:18 2022determine and print if a
number is positive, negative or zero@author: Carlos Andres Riveraccount:
11941225"""number = int (input("enter an integer: "))if number < 0: message = "is
negative"elif number == 0: message = "is zero"else: message = "is positive"print("the
number", message)
Task 1 - Python
# -*- coding: utf-8 -*-"""Created on Sun Feb 27 21:37:15 2022@author: Carlos Andres
Riveraaccount: 11941225An accountant needs a program to calculate the annual
depreciation expense of certain equipment according to the following depreciation
tableTYPE OF EQUIPMENT DEPRECIATION1 4 Years2 5 Years3 7 Years4 10 YearsThe
annual depreciation would be calculated by dividing the value of the equipment by the
years in which it depreciates according to the previous table. The computer will be
provided with the value of the equipment, calculate the annual depreciation."""Value=
float(input("Enter the value of the equipment: "))Type= int(input("Enter the type of
equipment: "))if Type == 1: DepA=Value/4elif Type==2: DepA=Value/5elif Type==3:
DepA=Value/7else: DepA=Value/10print()print("The annual depreciation is:
",round( DepA,2)
Python 6
# -*- coding: utf-8 -*-"""Created on Mon Feb 28 09:11:27 2022@author: Carlos Andres
Riveraaccount: 11941225A group of people dedicated to the car washing business needs
a program to determine How much does each client have to pay according to the following
table of services: TYPE OF SERVICE PRICE 1. – EXTERIOR WASHING Lps. 225.00 2. -
INTERIOR WASH Lps. 130.00 3. - EXTERIOR AND INTERIOR WASHING Lps. 335.00 4.
- ENGINE WASH Lps. 240.00 In addition to services, a 7% discount is offered if you bring
two or more cars. The Type of service and No. will be provided to the computer. of
automobiles, calculate the total to be paid by the customer."""print("############")print("
TYPE OF SERVICE PRICE")print(" 1. EXTERIOR WASHING Lps. 225.00")print(" 2.
INTERIOR WASHING Lps. 130.00")print(" 3. EXTERIOR AND INTERIOR WASHING Lps.
335.00")print(" 4. ENGINE WASH Lps. 240.00")print("############")type=
int(input("Enter service type(1,2,3,4):"))qty= int(input ("Enter the number of cars: "))if type
== 1: description = "Exterior Wash" subtotal = 225 * cantelif type == 2: description =
"Interior Wash" subtotal = 130 * cantelif type == 3: description = "Exterior and Interior
Washing" subtotal = 335 * cantelif type == 4: description = "Motorcycle Wash" subtotal =
240 * cantelse: description = "Incorrect Type does not exist!!" subtotal = 0if qty >= 2:
discount = subtotal * 0.07else: discount = 0 total = subtotal -
discountprint("##############")print(" type of service requested:", description)print("
Subtotal per service: ",round(subtotal,2))print(" discount for services:",(discount,2))print("
total to pay: ",(total,2))print("######## ######")
Python 7
# -*- coding: utf-8 -*-"""Created on Mon Feb 28 22:38:15 2022@author: Carlos Andres
Rivera account:11941225In a cafeteria, basically three types of food are sold: 1 -
breakfast, 2 - lunch , 3 - dinner with prices of L. 220.00, L 300.00 and L. 200.00 per person
respectively. In addition, a free jug of soft drink is offered if the group is more than three
people. If the meal code (1, 2 or 3) and the number of people in the group are provided,
determine the total to be paid by the group, and print the message "Free Pitcher" when
necessary."""code= int(input("Enter the food code: "))people=int(input("Enter the number of
people in the group: "))if code==1: price=220elif code==2: price= 300elif code==3:
price=200else: message="Error! combo not available" price=0totalp=people*priceif
people>3: jugs="Free Jugs"else: jugs="Does not apply to
combo"print("#########")print("Total a pay is: ",round(totalp,2))print("Promotion!:
",jars)print("#########"

Review delivery history: Python 7


Python 8
# -*- coding: utf-8 -*-"""Created on Tue Mar 1 09:17:00 2022@author: Carlos Andres
Riveraaccount: 11941225In a children's play park the entrance for children over 10 years
old or equal is L. 80.00 and L. 50.00 for children under 10. If the group includes 2 or more
children, the price for each one is L. 60.50. Since staying in the park requires the presence
of adults, you will be charged L. 100.00 for each adult. If the computer is provided with the
number of children entering, the age if it is only one, and the number of adults, determine
the total to be paid by the group."""numn = int(input("enter the number of children who
entered the park: "))numa = int(input("enter the number of adults: "))if numn > 1: #when
there are 2 children or more pricen = 60.5 *numnelif numn == 1: #when it is a child age =
int(input("enter the child's age: ")) if age >= 10: pricen = 80.00 else: pricen = 50.00else: #
the user made a mistake when entering the number of children. pricen = 0 pricea = numa *
100total = pricen + priceaprint("####################")print("number of
children:",numn)print(" number of
adults :",numa)print("####################")print("payment for
children :",round(price,2))print ("payment for adults:",round(pricea,2))print("total payment
for the group:",round(total,2)
Python 9
# -*- coding: utf-8 -*-"""Created on Tue Mar 1 23:52:05 2022@author: Carlos Andres
Rivera account: 11941225A company that is dedicated to shipping packages charges $.
5.80 plus an amount based on the package according to the following table:WEIGHT IN
POUNDPRICE PER POUND25 or less$. 0.1545 or less$. 0.25more than $45. 0.35There is
an additional charge of $. 5.00 if package volume exceeds 15 cubic feet. If the volume and
weight are provided, determine the total to be paid by the
customer."""volume=float(input("Enter the volume of the package: "))weight=
float(input("Enter the weight of the package in pounds : "))if weight<=25:
poundprice=0.15elif weight <=45: poundprice=0.25elif weight > 45: poundprice=0.35else:
poundprice=0if volume>15: chargeA=5else: chargeA=0totalP= 5.80+( weight*pricepound)
+chargeAif weight and volume >0: print() print("Total to pay is: ",round(totalP,2))else:
print("Weight and Volume incorrect!") totalP=0 print ("Total to pay: ",total
Python
10
# -*- coding: utf-8 -*-"""Created on Wed Mar 2 08:59:41 2022@author: Carlos Andres
Riveraaccount: 11941225The “Del Centro” Light Company wishes to print the collection
receipts of the account holders, in the last period. For each client, their name, address,
initial registration and final registration are entered. The charge is made based on the
following table: CONSUMPTION RATE 140 KVH or less Lps. 150.20 The following 170
KVH Lps. 10.15 per KVH Excess over 310 KVH Lps.15.10 per KVH"""name = input("Enter
the customer name: ")address = input("enter the customer address: ")RegI =
int(input("enter the initial register (hvh): "))RegF = int(input("enter final register (kvh):
"))consumption = RegF - RegIif consumption >0 and consumption <=140: payment =
150.20elif consumption > 140 and consumption <= 310: payment = 150.2 + (consumption -
140) *10.15elif consumption > 310: payment = 150.2 + 170 * 10.15 + (consumption - 310) *
15.10else: payment = 0print("######## ###################")print("customer name :
",name)print("customer address : ",address)print("initial record kvh : ",RegI)print("final
record kvh: ",RegF)print("consumption of the month kvh:
",consumption)print("#################### #######")print("total to pay:
",round(payment,2))print("###################### #####")
Python
11
# -*- coding: utf-8 -*-"""Created on Thu Mar 3 08:54:26 2022@author: Carlos Andres
Riveraaccount: 11941225A car factory has several employees working in two shifts:
morning(0) and afternoon (1). Considering the number of weekly hours worked, we wish to
calculate the weekly salary earned by each employee if it is known that everyone works 5
days a week and under the following rates: L. 60.00 per hour: morning shift · L. 80.00 per
hour: afternoon shiftIn addition, if more than 40 hours per week are exceeded, the hours
are considered overtime and are paid at the rate of: · 2 times the ordinary hour for the
morning shift · 3 times the ordinary hour for the afternoon shift
afternoon"""weekly_hours=int(input("Enter the number of weekly hours worked:
"))shift=int(input("Enter the employee's shift: "))if shift==0: hourly payment=60elif shift= =1:
hourly payment=80else: hourly payment=0 print("Error, I did not enter the shift correctly")
salary=(week_hours*hour_payment)if weekly_hours>40 and shift==0: extra
hours=weekly_hours-40extra payment=2*hour_payment salary=
(extrahours*extrapayment)+40*payperhourelif weekly_hours>40 and
shift==1:extrahours=weekly_hours-40extrapay=3*payperhour salary=(extrahours*extrapay)
+40*payperhourelse:extrapay=0print("##### ##########")print("The employee's salary is:
",round(salary,2)
Python
12
# -*- coding: utf-8 -*-"""Created on Mon Mar 7 09:01:42 2022@author: Carlos Andres
Riveraaccount: 11941225We wish to develop a program to calculate the final grade for
each of the students enrolled in Programming class I. During the course, three theoretical
exams are given, weighted at 15%, 20% and 25%, and the respective practical cumulative
exams include: research papers, tasks and projects weighted at: 10%, 15% and 15%. If the
grades are all provided based on 100 points, calculate and print the final grade for each
student"""response = int(input("you want to enter the program: 1. Yes 2. no"))while
response ==1: ## program inputs print("enter the following grade data based on 100
points") exam1 = float(input("enter exam grade 1: ")) exam2 = float(input("enter exam
grade 2: ")) exam3 = float(input("enter exam grade 3: ")) invest = float(input("enter research
grade: ")) task = float(input("enter assignment grade: ")) project = float(input("enter project
grade: ")) ## processFnote = exam1 * 0.15 + exam2 * 0.20 + exam3 * 0.25 + invest * 0.10
+ Task * 0.15 + Project * 0.15 if notef> = 60: Message = "approved" Else: Message = "Not
approved" ## Print output () #deja a Nrint/m +
444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
444444444444444444444444444444444444444444444444444444444444MAM PRN
print("student's final grade: ",round(Fnote,2)) print("student's status: ",message)
nri nt/"+44444444444444444444444444444444444444444444444444444444444m nri nt/
prn prn
#leave a line input("press any key to continue ") response = int(input("you want to enter the
program again: 1. Yes 2. no: "))print("end of program"
Python
13
# -*- coding: utf-8 -*-"""Created on Tue Mar 8 08:47:08 2022@author: Carlos Andres
Riveraaccount: 119412251. In the company “Paga Bien” they request a program to
calculate the new salary of their employees, in this program the salary of each worker is
read and a 20% increase is applied if their salary is less than Lps. 4000.00 and 15%
otherwise, the new salary must be published and at the end the following must be
indicated: How many employees received a 20% increase and how many 15% How many
employees there are in total. The total of the new Payroll. """response = int(input("you want
to enter the program: 1. Yes 2. No"))#initialization of counters and accumulatorscounter20
= 0 # employee counter increase 20%counter15 = 0 # employee counter increase
15%totalE = 0 #total employeestotalP = 0 #total of templatewhile response ==1: ## entries
from the program salaryA = float(input("enter the employee's current salary: ")) ## process
if salaryA < 4000: increase = salaryA * 0.20 else: increase = salaryA * 0.15 salaryN =
salaryA + increase ## output print(" ###############") print(" new salary is: ",
round(salaryN,2)) print("############# ######") response = int(input("you want to enter
the program again: 1. Yes 2. no")) print("end of program")
Final Project Statement
StatementIn a recognizable cafeteria they have the following products
available:Code Description Price1 Cappuccino 400ml 702 Cappuccino 600ml 903
Cappuccino 1L 110In order to motivate customers in a healthy way, the owner of
the cafeteria decided to give a discount depending on the amount of products they
consume.Code Description Discount1 If they carry between 500 1500 4%2 If they
have more than 1500 7%3 Less than 500 0%'

The discount can be granted to all customers and the subtotal will be subtracted.
The customer's name, product code and the quantity of the product they are
carrying are read. The name, product description, subtotal, discount and the total to
be paid must be printed. The owner of the cafeteria wants the following data: Total
number of customers who were served. Total number of customers with 500
products or more. Total number of customers who purchased 600mlQuantity of
600ml soldQuantity of 400ml sold
Preview
1
# -*- coding: utf-8 -*-"""Created on Tue Mar 15 09:06:46 2022@author: Carlos Andres
Riveraccount: 11941225In a recognizable cafeteria they have the following products
available:Code Description Price1 Cappuccino 400ml 702 Cappuccino 600ml 903
Cappuccino 1L 110In order to motivate customers in a healthy way, the owner of the
cafeteria decided to give a discount depending on the amount of products they
consume.Code Description Discount1 If they carry between 500-1500 4%2 If they carry
more than 1500 7 %3 Less than 500 0%'The discount may be granted to all customers and
the subtotal will be subtracted. The customer's name, product code and the quantity of the
product they are carrying are read. The name, product description, subtotal, discount and
the total to be paid must be printed. The owner of the cafeteria wants the following data:
Total number of customers who were served. Total number of customers with 500 products
or more. Total number of customers who purchased 600mlQuantity of 600ml soldQuantity
of 400ml soldTotal income"""response = int(input("you want to enter the program: 1. Yes 2.
no: "))while response == 1: ## program inputs name = input(" enter customer name: ") code
= int(input(" enter product code: ")) quantity = int(input ("enter product quantity:"))
Final project

-*- coding: utf-8 -*-"""Created on Tue Mar 15 09:06:46 2022@author: Carlos


Andres Riveraccount: 11941225In a recognizable cafeteria they have the following
products available:Code Description Price1 Cappuccino 400ml 702 Cappuccino
600ml 903 Cappuccino 1L 110In order to motivate customers in a healthy way, the
owner of the cafeteria decided to grant a discount depending on the amount of
products they consume.Code Description Discount1 If they carry between 500-
1500 4%2 If they carry more than 1500 7% 3 Less than 500 0%'The discount may
be granted to all customers and the subtotal will be subtracted. The customer's
name, product code and the quantity of the product they are carrying are read. The
name, product description, subtotal, discount and the total to be paid must be
printed. The owner of the cafeteria wants the following data: Total number of
customers who were served. Total number of customers with 500 products or
more. Total number of customers who purchased 600mlQuantity of 600ml
soldQuantity of 400ml soldTotal income"""response= int(input("You want to enter
the program: 1. Yes 2. No:
"))totalCA=0totalC500=0totalC400mL=0quantidad400LV=0quantidad600LV=0input
T=0while response == 1: ## Program inputs totalCA=totalCA+1 name=input("Enter
the customer name: ") code=int (input("Enter the product code: "))
quantity=int(input("Enter the product quantity: ")) responseDiscount=int(input("The
customer takes more than 1000 products 1.Yes 2.No : ")) ## Process if code==1:
description="Cappuccino 400ml" totalC400mL=totalC400mL+1
quantity400LV=quantity400LV+quantity price=70 elif code==2:
description="Cappuccino 600ml" quantity600LV=quantity600LV+quantity price =90
elif code==3: description="Cappuccino 1l" price=110 else: print("ERROR!!!Enter
the correct code") price=0 subtotal=quantity*price if responseDiscount==1:
totalC500=totalC500+ 1 if 500<=quantity<=1000: discount=subtotal*0.04 elif
quantity>100: discount=subtotal*0.07 else: discount=0 else: discount=0
totalP=subtotal-discount incomeT=incomeT+totalP ## Output print( )
print("Customer name: ",name) print("Product description: ",description) print("The
subtotal is: L. ",round(subtotal,2)) print("The discount is: L. ",round(discount,2))
print("The total to pay is: L. ",round(totalP,2)) response=int(input("You want to enter
the program again: 1. Yes 2. No: ")) print()print("Total customers served:
",totalCA)print("Total customers who brought more than 500 products:
",totalC500)print("Total customers who brought 400mL:
",totalC400mL )print("Quantity of 400mL sold: ",quantidad400LV)print("Quantity of
600mL sold: ",quantidad600LV)print("Total income is: ",incomeT)print()print("End of
program")

You might also like