Professional Documents
Culture Documents
II. MATERIALS
III. PROBLEM
1. Create a simple calculator program for a cashier in a grocery. Your program will
require inputting the price of three items, the payment of the customer; and also if
the customer is a senior citizen or not. Use the following below as a reference for
your computation.
a. All items are subject to a 10% tax rate.
b. If the customer is a senior citizen, they have a discount of 20%
c. At the end of the program, display the change of the customer. Display also
if the payment of the customer is insufficient.
2. The basic rate of a bus is 10php for the first 1km and an additional 2php for every
succeeding 2kms. Input the distance the commuter will travel (in m), and the
payment. Display the total distance travel (in km), the cost of the travel, and the
change of the commuter. Display also if the payment of the commuter is not
sufficient.
For numbers 3-5: If the input voltage in the switch is 5V, it means it is ACTIVE. If the
input voltage is less than 5V, it means it is CUTOFF. If the input voltage is greater than
5V, it means it is BREAKDOWN. Assuming there are three switches SWA, SWB and
SWC;
3. The program will ask for an input voltage for the three switches, and display “LED
ON” if all switches are ACTIVE, otherwise, display “LED OFF”. (Do not use
logical operators)
4. The program will ask for an input voltage for the three switches, and display “LED
ON” if SWA is ACTIVE or both SWB and SWC are breakdowns. Otherwise,
display “LED OFF”. (Do not use logical operators)
2
5. The program will ask for an input voltage for the three switches, and display “LED
ON” if at least one of the switches is ACTIVE, otherwise, display “LED OFF”.
3
# 2. The basic rate of a bus is 10php for the first 1km and
# an additional 2php for every succeeding 2kms. Input the
# distance the commuter will travel (in m), and the payment.
# Display the total distance travel (in km), the cost of
# the travel, and the change of the commuter. Display also
# if the payment of the commuter is not sufficient.
d = float(input("Commuter distance travelled (meters): "))
d *= 0.001 # conversion to km
payment = float(input("Commuter's payment: "))
cost = 10
if d >= 2:
cost += (int(d / 2) * 2)
4
# 3. at least one of the switches is ACTIVE, otherwise,
# display “LED OFF”.
swA = float(input("Enter voltage for switch A: "))
swB = float(input("Enter voltage for switch B: "))
swC = float(input("Enter voltage for switch C: "))
V. OUTPUT
5
CONCLUSION
6
REFERENCES
Rubrics: