SlideShare a Scribd company logo
1 of 15
Download to read offline
Assessment
Name: Cleofas, Vince Joseph R.__ Year Level: 1st year BSIT
SectionCEIT-37-101P Date: 10-27-21
Lecture Activity 4.1: Flowcharting (Sequence Structure)
Instructions: Create a program plan, an algorithm, and draw a flowchart that uses
sequence structure, that would accept a radius of a circle and compute its area,
circumferenceand diameter. Use constant declaration.
Area = pi * radius2
Circumference = 2 * pi * radius
Diameter = 2 * radius
Program Plan
Required Output A program that accept a radius of a
circle and compute its area,
circumferenceand diameter
Available Input Area = A
Circumference = C
Diameter = D
Radius = R
Pi = 3.1416
Processing Requirements A = pi * radius2
C = 2 * pi * radius
D = 2 * radius
Algorithm
1. Start
2. Input R
3. To obtain Area, Use this formula A = pi * radius2
4. To get the circumference, Use this formula C = 2 * pi * radius
5. Calculate the Diameter with the formula D = 2 * radius
6. Print A, C, D
7. Stop
Good Luck!
Flowchart
Start
ReadA, C, D,
R, Pi
A = pi * radius2
C = 2 * pi * radius
D = 2 * radius
Print A,C, D
Stop
Lecture Activity 4.2: Flowcharting (Sequence Structure)
Instructions: Create a program plan, an algorithm, and draw a flowchart that uses
sequence structure, that would accept two (2) numbers represented by X and Y. Print
the two numbers after interchanging their values.
Program Plan
Required Output Program that accept two (2) numbers
represented by X and Y. Print the two
numbers after interchanging their values.
Available Input Input X, Y
Processing Requirements Temp = X
X = Y
Y = Temp
Algorithm
1. Start
2. Read X, Y
3. To interchange the value of X to Y, Use this formula Temp = X, X=Y, Y = Temp
4. Print interchanged value of X, Y
5. Stop
Flowchart
Start
ReadX, Y
Temp= X
X = Y
Y = Temp
Print interchanged
value of X,Y
Stop
Lecture Activity 4.3: Flowcharting (SelectionStructure)
Given is GROSS_PAY. Draw a flowchart that will compute for DEDUCTIONS and
NET_PAY for employee’s weeklypayroll. Consider the following 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]
Program Plan
Required Output Program that compute for Deduction
and net pay for employees weekly
payroll
Available Input DEDUCTIONS, NET_PAY, GROSS_PAY
Processing Requirements 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
[NET_PAY = GROSS_PAY – DEDUCTIONS]
Algorithm
1. Start
2. Read GROSS_PAY, DEDUCTIONS, NET_PAY
3. Input Civil Status
4. Calculate the Net pay by using the formula NET_PAY = GROSS_PAY –
DEDUCTIONS
5. Print NET_PAY
6. Stop
Flowchart
Start
ReadDEDUCTIONS,
NET_PAY,
GROSS_PAY
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
InputCivil Status
NET_PAY= GROSS_PAY– DEDUCTIONS
Print NET_PAY
Stop
Lecture Activity 4.4: Flowcharting (SelectionStructure)
A company classifies its products by weight as follows:
CLASS A – 12 pounds or over
CLASS B – 5 to 11 pounds
CLASS C – less than 5 pounds
Show the logic of determininginto which class to place an item.
Program Plan
Required Output A program that determine which class to
place an item depends on the weight
Available Input Wt. = Weight
Processing Requirements CLASS A – 12 pounds or over
CLASS B – 5 to 11 pounds
CLASS C – less than 5 pounds
Algorithm
1. Start
2. Read Wt.
3. Input Wt.
4. Determine the class depends on weight of products.
5. If the item is over 12 pounds then it is CLASS A, If 5-10 pounds then it is CLASS B,
if less than 5 pounds it is belong to CLASS C.
6. Print Class A, B ,C
7. Stop
Flowchart
YES
NO
YES
NO
YES
NO
Start
InputWt.
If Wt.>=12
CLASSA
If Wt.<=11
CLASSB
If Wt.<=5 CLASSC
Stop
Lecture Activity 4.5: Flowcharting (IterationStructure)
Write an algorithm and draw a flowchart that will convert a given decimal number (N10)
to its equivalent binary number (N2).
Program Plan
Required Output Program that convert a given decimal
number (N10) to its equivalent binary
number (N2).
Available Input (N10) = DN
DN = 25
Remainder = r
Binary Number = BN
BN = r
Processing Requirements 25 / 2 = 12 r = 1
12 / 2 = 6 r = 0
6 / 2 = 3 r = 0
3 / 2 = 1 r = 1
1 / 2 = 0 r = 1
Algorithm
1. Start
2. Read BN = r, DN = 25
3. Calculate the DN to get the BN by dividing the given DN = 25 which is the
dividend and 2 is the divisor, until the quotient becomes 0, then the remainders
is considered as the binary number.
4. Print BN
5. Stop
Flowchart
Start
ReadBN = r, DN = 25
25 / 2 = 12 r = 1
12 / 2 = 6 r = 0
6 / 2 = 3 r = 0
3 / 2 = 1 r = 1
1 / 2 = 0 r = 1
Print BN
Stop
Lecture Activity 4.6: Flowcharting (IterationStructure)
An electric company bases its charges on two rates, customers are charged
P25.00 per kilowatt-hour for the first 300 kilowatt-hours used in a month and P30.00 each
for all kilowatt-hoursusedthereafter.Computefor theamount due froma customer after
reading the kilowatt-hours used. Assume that there are 100 records of customers.
Program Plan
Required Output Program that compute for the amount
due from a customer after reading the
kilowatt-hours used.
Available Input Kilowatt-hour = kWh
Amount due
Processing Requirements 300 kWh = P25.00
300 kWh >= P30.00
Algorithm
1. Start
2. Read kWh
3. If the customer has 300 kWh used in a month the charged is P25.00, If the
customer has 300 kWh above used in a month then the charged is P30.00
4. Print amount due
5. Stop
Flowchart
Start
ReadkWh
If kWh = 300
If kWh >= 300
P25.00
P30.00
Print amountdue
Stop
Lecture Activity 4.7: Design Tools €Pseudocode)
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.
Program Plan
Required Output The program is to read the cards and
store the proper code in each card.
Available Input Local = Loc
National = Natl
International = Intl
Credit Card = CC
Processing Requirements If credit card is local then 01,
If credit card is national then 02,
If credit card is international then 03.
Algorithm
1. Start
2. Read Loc, Natl, Intl, CC
3. Initialize the CC to its proper code depends on the process requirements
4. Print CC
5. Stop
PSEUDOCODE
Initialize Loc to 01
Initialize Natl to 02
Initialize Intl to 03
If the credit card holder resides in metro manila then
Print ‘code is 01’
If the credit card holder resides anywhere in the Philippines then
Print ‘code is 02’
If the credit card holder resides anywhere in the world then
Print ‘code is 03’
Endif
Stop
Lecture_Activities_4.1_to_4.7.pdf.pdf

More Related Content

What's hot

Refrigeration and air conditioning
Refrigeration and air conditioningRefrigeration and air conditioning
Refrigeration and air conditioning
Er Santhosh
 
Projet de programmation la conversion entre les bases
Projet de programmation   la conversion entre les bases Projet de programmation   la conversion entre les bases
Projet de programmation la conversion entre les bases
Tunisie collège
 
Transfert de chaleur dans le bâtiment 02
Transfert de chaleur dans le bâtiment 02Transfert de chaleur dans le bâtiment 02
Transfert de chaleur dans le bâtiment 02
Sami Sahli
 
Refrigeration system (MECH 324)
Refrigeration system (MECH 324)Refrigeration system (MECH 324)
Refrigeration system (MECH 324)
Yuri Melliza
 

What's hot (20)

TD MACHINES THERMIQUES
TD MACHINES THERMIQUESTD MACHINES THERMIQUES
TD MACHINES THERMIQUES
 
Dumper
DumperDumper
Dumper
 
Initiation à l'algorithmique
Initiation à l'algorithmiqueInitiation à l'algorithmique
Initiation à l'algorithmique
 
Duct Design
Duct Design Duct Design
Duct Design
 
Serie
SerieSerie
Serie
 
Refrigeration and air conditioning
Refrigeration and air conditioningRefrigeration and air conditioning
Refrigeration and air conditioning
 
Exercices corriges nombres_complexes
Exercices corriges nombres_complexesExercices corriges nombres_complexes
Exercices corriges nombres_complexes
 
Projet de programmation la conversion entre les bases
Projet de programmation   la conversion entre les bases Projet de programmation   la conversion entre les bases
Projet de programmation la conversion entre les bases
 
Cycles combines et de cogeneration - Copy (1).pptx
Cycles combines et de cogeneration - Copy (1).pptxCycles combines et de cogeneration - Copy (1).pptx
Cycles combines et de cogeneration - Copy (1).pptx
 
Transfert de chaleur dans le bâtiment 02
Transfert de chaleur dans le bâtiment 02Transfert de chaleur dans le bâtiment 02
Transfert de chaleur dans le bâtiment 02
 
Refrigeration system (MECH 324)
Refrigeration system (MECH 324)Refrigeration system (MECH 324)
Refrigeration system (MECH 324)
 
Energy management in agriculture revised lecture notes
Energy management in agriculture revised lecture notesEnergy management in agriculture revised lecture notes
Energy management in agriculture revised lecture notes
 
Principes de base_chauffage
Principes de base_chauffagePrincipes de base_chauffage
Principes de base_chauffage
 
JAVA, JDBC et liaison base de données
JAVA, JDBC et liaison base de donnéesJAVA, JDBC et liaison base de données
JAVA, JDBC et liaison base de données
 
PréSentation Tpe
PréSentation TpePréSentation Tpe
PréSentation Tpe
 
Programmation en C
Programmation en CProgrammation en C
Programmation en C
 
cours fortran.pptx
cours fortran.pptxcours fortran.pptx
cours fortran.pptx
 
algorithmique
algorithmiquealgorithmique
algorithmique
 
Chap1: Cours en C++
Chap1: Cours en C++Chap1: Cours en C++
Chap1: Cours en C++
 
Ladder
LadderLadder
Ladder
 

Similar to Lecture_Activities_4.1_to_4.7.pdf.pdf

Chapter 13 breakeven analysis
Chapter 13   breakeven analysisChapter 13   breakeven analysis
Chapter 13 breakeven analysis
Bich Lien Pham
 
Chapter 13 breakeven analysis
Chapter 13   breakeven analysisChapter 13   breakeven analysis
Chapter 13 breakeven analysis
Bich Lien Pham
 
1 University of Leeds School of Computing Proced.docx
1 University of Leeds       School of Computing Proced.docx1 University of Leeds       School of Computing Proced.docx
1 University of Leeds School of Computing Proced.docx
jeremylockett77
 
8.2 approach in problem solving (9 hour)
8.2 approach in problem solving (9 hour)8.2 approach in problem solving (9 hour)
8.2 approach in problem solving (9 hour)
Fiqry Suryansyah
 

Similar to Lecture_Activities_4.1_to_4.7.pdf.pdf (20)

PSP LAB MANUAL.pdf
PSP LAB MANUAL.pdfPSP LAB MANUAL.pdf
PSP LAB MANUAL.pdf
 
Pseudocode algorithim flowchart
Pseudocode algorithim flowchartPseudocode algorithim flowchart
Pseudocode algorithim flowchart
 
LMmanual.pdf
LMmanual.pdfLMmanual.pdf
LMmanual.pdf
 
COMPUTER SCIENCE INVESTIGATORY PROJECT 2017-18
COMPUTER SCIENCE INVESTIGATORY PROJECT 2017-18COMPUTER SCIENCE INVESTIGATORY PROJECT 2017-18
COMPUTER SCIENCE INVESTIGATORY PROJECT 2017-18
 
Plsql programs(encrypted)
Plsql programs(encrypted)Plsql programs(encrypted)
Plsql programs(encrypted)
 
7 Examples of C Program (Civil Engineering)
7 Examples of C Program (Civil Engineering)7 Examples of C Program (Civil Engineering)
7 Examples of C Program (Civil Engineering)
 
Chapter 13 breakeven analysis
Chapter 13   breakeven analysisChapter 13   breakeven analysis
Chapter 13 breakeven analysis
 
Chapter 13 breakeven analysis
Chapter 13   breakeven analysisChapter 13   breakeven analysis
Chapter 13 breakeven analysis
 
Elaboración de las alternativas mutuamente excluyentes
Elaboración de las alternativas mutuamente excluyentesElaboración de las alternativas mutuamente excluyentes
Elaboración de las alternativas mutuamente excluyentes
 
CSC1100 - Chapter12 - Flow Charts
CSC1100 - Chapter12 - Flow ChartsCSC1100 - Chapter12 - Flow Charts
CSC1100 - Chapter12 - Flow Charts
 
1 University of Leeds School of Computing Proced.docx
1 University of Leeds       School of Computing Proced.docx1 University of Leeds       School of Computing Proced.docx
1 University of Leeds School of Computing Proced.docx
 
COMP 122 Entire Course NEW
COMP 122 Entire Course NEWCOMP 122 Entire Course NEW
COMP 122 Entire Course NEW
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1
 
8.2 approach in problem solving (9 hour)
8.2 approach in problem solving (9 hour)8.2 approach in problem solving (9 hour)
8.2 approach in problem solving (9 hour)
 
Logic Development and Algorithm.
Logic Development and Algorithm.Logic Development and Algorithm.
Logic Development and Algorithm.
 
Pooja Bijawat,Bachelor Degree in Computer Application
Pooja Bijawat,Bachelor Degree in Computer ApplicationPooja Bijawat,Bachelor Degree in Computer Application
Pooja Bijawat,Bachelor Degree in Computer Application
 
Isc computer project final upload last
Isc computer project final upload lastIsc computer project final upload last
Isc computer project final upload last
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
03b loops
03b   loops03b   loops
03b loops
 
Calculator Manipulation.pptx
Calculator Manipulation.pptxCalculator Manipulation.pptx
Calculator Manipulation.pptx
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Lecture_Activities_4.1_to_4.7.pdf.pdf

  • 1. Assessment Name: Cleofas, Vince Joseph R.__ Year Level: 1st year BSIT SectionCEIT-37-101P Date: 10-27-21 Lecture Activity 4.1: Flowcharting (Sequence Structure) Instructions: Create a program plan, an algorithm, and draw a flowchart that uses sequence structure, that would accept a radius of a circle and compute its area, circumferenceand diameter. Use constant declaration. Area = pi * radius2 Circumference = 2 * pi * radius Diameter = 2 * radius Program Plan Required Output A program that accept a radius of a circle and compute its area, circumferenceand diameter Available Input Area = A Circumference = C Diameter = D Radius = R Pi = 3.1416 Processing Requirements A = pi * radius2 C = 2 * pi * radius D = 2 * radius Algorithm 1. Start 2. Input R 3. To obtain Area, Use this formula A = pi * radius2 4. To get the circumference, Use this formula C = 2 * pi * radius 5. Calculate the Diameter with the formula D = 2 * radius 6. Print A, C, D 7. Stop Good Luck!
  • 2. Flowchart Start ReadA, C, D, R, Pi A = pi * radius2 C = 2 * pi * radius D = 2 * radius Print A,C, D Stop
  • 3. Lecture Activity 4.2: Flowcharting (Sequence Structure) Instructions: Create a program plan, an algorithm, and draw a flowchart that uses sequence structure, that would accept two (2) numbers represented by X and Y. Print the two numbers after interchanging their values. Program Plan Required Output Program that accept two (2) numbers represented by X and Y. Print the two numbers after interchanging their values. Available Input Input X, Y Processing Requirements Temp = X X = Y Y = Temp Algorithm 1. Start 2. Read X, Y 3. To interchange the value of X to Y, Use this formula Temp = X, X=Y, Y = Temp 4. Print interchanged value of X, Y 5. Stop
  • 4. Flowchart Start ReadX, Y Temp= X X = Y Y = Temp Print interchanged value of X,Y Stop
  • 5. Lecture Activity 4.3: Flowcharting (SelectionStructure) Given is GROSS_PAY. Draw a flowchart that will compute for DEDUCTIONS and NET_PAY for employee’s weeklypayroll. Consider the following 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] Program Plan Required Output Program that compute for Deduction and net pay for employees weekly payroll Available Input DEDUCTIONS, NET_PAY, GROSS_PAY Processing Requirements 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 [NET_PAY = GROSS_PAY – DEDUCTIONS] Algorithm 1. Start 2. Read GROSS_PAY, DEDUCTIONS, NET_PAY 3. Input Civil Status 4. Calculate the Net pay by using the formula NET_PAY = GROSS_PAY – DEDUCTIONS 5. Print NET_PAY 6. Stop
  • 6. Flowchart Start ReadDEDUCTIONS, NET_PAY, GROSS_PAY 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 InputCivil Status NET_PAY= GROSS_PAY– DEDUCTIONS Print NET_PAY Stop
  • 7. Lecture Activity 4.4: Flowcharting (SelectionStructure) A company classifies its products by weight as follows: CLASS A – 12 pounds or over CLASS B – 5 to 11 pounds CLASS C – less than 5 pounds Show the logic of determininginto which class to place an item. Program Plan Required Output A program that determine which class to place an item depends on the weight Available Input Wt. = Weight Processing Requirements CLASS A – 12 pounds or over CLASS B – 5 to 11 pounds CLASS C – less than 5 pounds Algorithm 1. Start 2. Read Wt. 3. Input Wt. 4. Determine the class depends on weight of products. 5. If the item is over 12 pounds then it is CLASS A, If 5-10 pounds then it is CLASS B, if less than 5 pounds it is belong to CLASS C. 6. Print Class A, B ,C 7. Stop
  • 9. Lecture Activity 4.5: Flowcharting (IterationStructure) Write an algorithm and draw a flowchart that will convert a given decimal number (N10) to its equivalent binary number (N2). Program Plan Required Output Program that convert a given decimal number (N10) to its equivalent binary number (N2). Available Input (N10) = DN DN = 25 Remainder = r Binary Number = BN BN = r Processing Requirements 25 / 2 = 12 r = 1 12 / 2 = 6 r = 0 6 / 2 = 3 r = 0 3 / 2 = 1 r = 1 1 / 2 = 0 r = 1 Algorithm 1. Start 2. Read BN = r, DN = 25 3. Calculate the DN to get the BN by dividing the given DN = 25 which is the dividend and 2 is the divisor, until the quotient becomes 0, then the remainders is considered as the binary number. 4. Print BN 5. Stop
  • 10. Flowchart Start ReadBN = r, DN = 25 25 / 2 = 12 r = 1 12 / 2 = 6 r = 0 6 / 2 = 3 r = 0 3 / 2 = 1 r = 1 1 / 2 = 0 r = 1 Print BN Stop
  • 11. Lecture Activity 4.6: Flowcharting (IterationStructure) An electric company bases its charges on two rates, customers are charged P25.00 per kilowatt-hour for the first 300 kilowatt-hours used in a month and P30.00 each for all kilowatt-hoursusedthereafter.Computefor theamount due froma customer after reading the kilowatt-hours used. Assume that there are 100 records of customers. Program Plan Required Output Program that compute for the amount due from a customer after reading the kilowatt-hours used. Available Input Kilowatt-hour = kWh Amount due Processing Requirements 300 kWh = P25.00 300 kWh >= P30.00 Algorithm 1. Start 2. Read kWh 3. If the customer has 300 kWh used in a month the charged is P25.00, If the customer has 300 kWh above used in a month then the charged is P30.00 4. Print amount due 5. Stop
  • 12. Flowchart Start ReadkWh If kWh = 300 If kWh >= 300 P25.00 P30.00 Print amountdue Stop
  • 13. Lecture Activity 4.7: Design Tools €Pseudocode) 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. Program Plan Required Output The program is to read the cards and store the proper code in each card. Available Input Local = Loc National = Natl International = Intl Credit Card = CC Processing Requirements If credit card is local then 01, If credit card is national then 02, If credit card is international then 03. Algorithm 1. Start 2. Read Loc, Natl, Intl, CC 3. Initialize the CC to its proper code depends on the process requirements 4. Print CC 5. Stop
  • 14. PSEUDOCODE Initialize Loc to 01 Initialize Natl to 02 Initialize Intl to 03 If the credit card holder resides in metro manila then Print ‘code is 01’ If the credit card holder resides anywhere in the Philippines then Print ‘code is 02’ If the credit card holder resides anywhere in the world then Print ‘code is 03’ Endif Stop