You are on page 1of 4

Laboratory 2

Chapter 3 : Modules

A. Stadium Seating

There are three seating categories at a stadium. For a softball game, Class A seats cost 1500, Class B
seats cost 1300, and Class C seats cost 1000. Design a modular program that asks how many tickets
for each class of seats were sold, and then displays the amount of income generated from ticket
sales.

PSEUDOCODE

FLOWCHART

ACTUAL CODE IN PYTHON

def income(ticket_A, ticket_B, ticket_C):


Class_A_cost = 1500
Class_B_cost = 1300
Class_C_cost = 1000
a_income = ticket_A * Class_A_cost
b_income = ticket_B * Class_B_cost
c_income = ticket_C * Class_C_cost
return a_income + b_income + c_income

num_of_ticket_A = int(input("Enter the number of tickets for Class A sold: "))


num_of_ticket_B = int(input("Enter the number of tickets for Class B sold: "))
num_of_ticket_C = int(input("Enter the number of tickets for Class C sold: "))

income = income(num_of_ticket_A, num_of_ticket_B, num_of_ticket_C )


print("The the amount of income generated from ticket sales: PHP " ,format(income , ',.2f'))

import ticketsales
print (ticketsales)

SCREENSHOT OF THE PROGRAM OUTPUT


B. Paint Job Estimator

A painting company has determined that for every 120 square feet of wall space, one gallon of paint
and eight hours of labor will be required. The company charges 40.00 per hour for labor. Design a
modular program that asks the user to enter the square feet of wall space to be painted and the
price of the paint per gallon. The program should display the following data:

● The number of gallons of paint required


● The hours of labor required

● The cost of the paint

● The labor charges

● The total cost of the paint job

PSEUDOCODE

FLOWCHART

ACTUAL CODE IN PYTHON

def painting():
num_square_foot = int(input('Enter square feet to be painted: '))
price_gall = float(input('Enter price per gallon of paint: PHP '))

totality(num_square_foot, price_gall)

def totality(square_footage, price_gall):


num_gallons = square_footage / 120
hrs_of_labor = num_gallons * 8
paint_charges = num_gallons * price_gall
total_labor = hrs_of_labor * 40
total_cost = paint_charges + total_labor

Show_Cost_Estimate(num_gallons, hrs_of_labor, paint_charges, total_labor, total_cost)

def Show_Cost_Estimate(num_gallons, hrs_of_labor, paint_charges, total_labor, total_cost):


print('Gallons of paint: ', format(num_gallons, '.0f'))
print('Hours of labor: ', format(hrs_of_labor, '.0f'))
print('Paint Charges: PHP', format((paint_charges), '.2f'))
print('Labor charges: PHP', format(total_labor, '.2f'))
print('Total cost: PHP', format(total_cost, '.2f'))

painting()

import PAINTBi
print (PAINTBi)

SCREENSHOT OF THE PROGRAM OUTPUT

You might also like