Instruction: Create a program plan, algorithm, flowchart and pseudocode for the following cases:
A Department Store classifies its credit card holders as to local, national and international. A local card holder resides in Metro Manila, a national, anywhere in the Philippines and an international, anywhere in the world. The programmer must store a code 01, 02, and 03 for local, national and international card holders respectively. The program is to read the cards and store the proper code in each card.
Create Program Plan, Algorithm, and Flowchart. An electric company bases its charges on two rates, customers are charged P 25.00 per kilowatt-hour for the first 300 kilowatt-hours used in a month and P 30.00 each for all kilowatt-hours used thereafter. Compute for the amount due from a customer after reading the kilowatt-hours used. Assume that there are 100 records of customers.
Write an Program Plan, Algorithm and draw a flowchart that will convert a given decimal number (N10) to its equivalent Binary number (N2).
Given is GROSS_PAY, draw a program plan, algorithm, and flowchart that will compute for DEDUCTIONS and NET_PAY for employee’s weekly Payroll. Consider the conditions:
If Civil Status = ‘SINGLE’
DEDUCTIONS = GROSS_PAY * 0.03
If Civil Status = ‘MARRIED’
DEDUCTIONS = GROSS_PAY * 0.06
If Civil Status = ‘WIDOW’
DEDUCTIONS = GROSS_PAY * 0.05
If Civil Status = HEAD OF THE FAMILY’
DEDUCTIONS = GROSS_PAY * 0.02
Using the formula:
[NET_PAY = GROSS_PAY – DEDUCTIONS]
Create Program Plan, Algorithm, and Flowchart
A company classifies its products by weights as follows:
Class A – 12 pound or over
Class B – 5 to 11.9 pounds
Class C – less than 5 pounds
Show the logic of determining into which class to place an item.
Given is GROSS_PAY, draw a flowchart that will compute for DEDUCTIONS and NET_PAY for employee’s weekly Payroll. Consider the conditions:
If Civil Status = ‘SINGLE’
DEDUCTIONS = GROSS_PAY * 0.03
If Civil Status = ‘MARRIED’
DEDUCTIONS = GROSS_PAY * 0.06
If Civil Status = ‘WIDOW’
DEDUCTIONS = GROSS_PAY * 0.05
If Civil Status = HEAD OF THE FAMILY’
DEDUCTIONS = GROSS_PAY * 0.02
Using the formula:
(Use Big O to calculate the following time complexity)
Q 1
def printPairs(array):
for i in array:
for j in array:
print(str(i)+","+str(j))
Q2
def printUnorderedPairs(array):
for i in range(0,len(array)):
for j in range(i+1,len(array)):
print(array[i] + "," + array[j])
#Question3
def printUnorderedPairs(arrayA, arrayB):
for i in range(len(arrayA)):
for j in range(len(arrayB)):
if arrayA[i] < arrayB[j]:
print(str(arrayA[i]) + "," + str(arrayB[j]))
arrayA = [1,2,3,4,5]
arrayB = [2,6,7,8]
DRAW A FLOWCHART USING THIS ALGORITHM
Start
Take input ( a decimal number like ‘a ‘)
Start the loop (for (i=0 ;i>1 ;i++))
Apply following calculation inside loop
ar[i]=a%2
a=a/2
Outside loop
ar[i]=a
start loop again for print (for (j=i; j>=0; j—) )
Out ar[j]
End
Draw a flowchart that will convert a given decimal number (N10) to its equivalent binary number (N2).
Create a program plan, an algorithm, and draw a flowchart that uses sequence structure, that would accept a radius of a circle and computes its area, circumference and diameter. Use constant declaration.
area = pi * radius2
circumference = 2 * pi * radius
diameter = 2* radius