Presentation is loading. Please wait.

Presentation is loading. Please wait.

JSP (Jackson Structured Programming)

Similar presentations


Presentation on theme: "JSP (Jackson Structured Programming)"— Presentation transcript:

1 JSP (Jackson Structured Programming)
Lesson 7 – Program Concepts

2 JSP (Jackson Structured Programming)
Methodology developed by Michael Anthony Jackson in 1970 Uses top-down methodology 3 structured constructs Sequence Selection Iteration/Repetition Professor Michael Anthony Jackson (born 1936) works as an independent computing consultant in London, England, and also as a part-time researcher at AT&T Research, Florham Park, NJ, U.S.. He is a visiting research professor at the Open University in the UK.

3 Sequence 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 A seq B C D A end

4 Selection 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 IF C1 THEN DO B ENDDO ELSE IF C2 THEN DO C IF C3 THEN DO D ENDIF

5 Iteration WHILE condition 1 DO 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. WHILE condition 1 DO B ENDDO

6 Example: Sequence

7 Example: Selection

8 Example: Iteration

9 JSP Function list Condition list
Sequence of actions listed Condition list Associated with selections and iterations Note: function & condition lists are listed separately from the structure diagram and are cross-referenced

10 JSP Stepwise 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

11 JSP Case Study A 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 < C >=80 and < B >= A For 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.

12 Case Study

13 Function List 1 : Initialise all variables, counters 2 : Get first record 3 : Input record 4 : Total Weighted score = 30% x Midterm Test 1+ 30% x Midterm Test % x Final Test 5 : Assign grade 6 : Increase Counter A by 1 7 : Increase Counter B by 1 8 : Increase Counter C by 1 9 : Increase Counter D by 1 10 : Increase Counter F by 1 11 : Print Student Number, Weighted Score and Grade. 12 : Get next record 13 : Print Summary Record 14 : End Program

14 Condition List C1 : Not EOF C2 : Total weighted score >= 90 C3 : Total weighted score >= 80 C4 : Total weighted score >= 70 C5 : Total weighted score >= 60 (Note to Lecturers: This is an easier solution as compared to the study guide, but acceptable for examination purposes.)


Download ppt "JSP (Jackson Structured Programming)"

Similar presentations


Ads by Google