JSP (Jackson Structured Programming)
description
Transcript of JSP (Jackson Structured Programming)
![Page 1: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/1.jpg)
JSP (Jackson Structured JSP (Jackson Structured Programming)Programming)Lesson 7 – Program Concepts
![Page 2: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/2.jpg)
JSP (Jackson Structured JSP (Jackson Structured Programming)Programming)Methodology developed by Michael
Anthony Jackson in 1970
Uses top-down methodology
3 structured constructs
◦Sequence
◦Selection
◦Iteration/Repetition
![Page 3: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/3.jpg)
SequenceSequence
A seqBCD
A end
A sequence of operations is represented by boxes connected with lines. In the example below, operation A consists of the sequence of operations B, C and D
![Page 4: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/4.jpg)
SelectionSelection
IF C1 THEN
DO B
ENDDO
ELSE
IF C2 THENDO CENDDO
ELSEIF C3 THEN
DO DENDDOENDIF
A sequence of operations is represented by boxes connected with lines. In the example below, operation A consists of the sequence of operations B, C and D
![Page 5: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/5.jpg)
IterationIteration
WHILE condition 1DO B
ENDDO
An iteration is again represented with joined boxes. In addition the iterated operation has a star in the top right corner of its box. In the example below, operation A consists of an iteration of zero or more invocations of operation B.
![Page 6: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/6.jpg)
Example: SequenceExample: Sequence
MainControl
Initial Body End
![Page 7: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/7.jpg)
Example: SelectionExample: Selection
Check AgeModule
Teenage Module0 Adult Module0
Where C1 is Age < 21
C1
![Page 8: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/8.jpg)
Example: IterationExample: Iteration
Main Process
Detail Process
While C1
C1 is not end of file
![Page 9: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/9.jpg)
JSPJSPFunction list
◦Sequence of actions listedCondition list
◦Associated with selections and iterations
Note: function & condition lists are listed separately from the structure diagram and are cross-referenced
![Page 10: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/10.jpg)
JSPJSPStepwise Refinement
◦A process to sub-divide (refine) the main program function into subsidiary functions
◦Increasing the details at each level until the lowest functions are represented
![Page 11: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/11.jpg)
JSPJSPCase StudyA program is needed to help a college to grade its students. A total weighted score is determined for students from two midterm exam scores both weighted at 30%, and a final exam score at 40%. A grade is assigned on the following basis:Total weighted score Grade <60 F >=60 and <70 D >=70 and <80 C >=80 and <90 B >=90 AFor each student, the program is to output the student number, the total weighted score and the grade assigned. It is also required to count the number of students receiving each of the five grades. The input will be in the form of a record, each consisting of student number, midterm test 1, midterm test 2 and final test mark. The iteration is to be terminated by a suitable dummy record. The summary will then be printed showing the distribution of the grades. Draw the JSP.
![Page 12: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/12.jpg)
Case StudyCase StudyMAIN-CTRL
INITIAL BODYEND
1,213,14 WHILE C1
PROCESS *
A o
OUTPUT &NEXT
RECORD
ASSIGNCALCULATIONINPUTRECORD
F oD o
C oB o
3
4
6 7 89
10
11,12
5
C2
C3 C4 C5
![Page 13: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/13.jpg)
Function ListFunction List1 : Initialise all variables, counters2 : Get first record3 : Input record4 : Total Weighted score = 30% x Midterm Test 1+
30% x Midterm Test 2 + 40% x Final Test 5 : Assign grade 6 : Increase Counter A by 17 : Increase Counter B by 18 : Increase Counter C by 1 9 : Increase Counter D by 110 : Increase Counter F by 1 11 : Print Student Number, Weighted Score and
Grade.12 : Get next record13 : Print Summary Record14 : End Program
![Page 14: JSP (Jackson Structured Programming)](https://reader035.fdocuments.in/reader035/viewer/2022062422/568135d2550346895d9d3bbb/html5/thumbnails/14.jpg)
Condition ListCondition List
C1 : Not EOFC2 : Total weighted score >= 90C3 : Total weighted score >= 80C4 : Total weighted score >= 70C5 : Total weighted score >= 60
(Note to Lecturers: This is an easier solution as compared to the study guide, but acceptable for examination purposes.)