Fadi P. Deek and Maura A. Deek
September 1995
INTRODUCTION
This course is the first requirement of the computer science core and is usually taken in the freshman year by those students majoring in Computer Science, Information Systems, Mathematics, Physics, and Science/ Technology/ Society. Students entering CIS 113 exhibit a wide range of pre-college preparation. For many this would be their first contact with a computer. On the other hand, some would have taken a year or more of programming courses in High School. Finding a common ground is one of the challenges for the course instructor. Providing the students with a solid background in problem solving and programming to succeed in the subsequent course on data structures and algorithms is another challenge. No prerequisites are assumed for the course. However, Calculus I is a corequisite.
Multiple sections of the course are offered every semester and in both summer sessions. The same instructor, assisted by teaching assistants, teaches all day sections. The Virtual Classroom sections (Spring and Fall 94 sections) described in this report were also taught by the same day sections instructor (F. Deek). Subsequent sections were taught by a different instructor (M. Deek).
ABOUT THE COURSE
The course covers fundamentals of computer science with emphasis on problem solving and programming. Topics include basic concepts of computer systems, software engineering, algorithm design, programming methodology, and data abstraction. Upon successful completion of the course, students are expected to comprehend the structure and use of a computer system including the various software and hardware support facilities that are available, and the internal representation of information; to be able to use a high-level programming language and apply a disciplined approach to problem solving, algorithm development and program construction by use of top-down design techniques, including modular construction and stepwise refinement; and to acquire the necessary background for success in further study of computer science (Appendix 1 contains the complete course syllabus which was received by students taking the course).
DELIVERY OF CIS 113 THROUGH DISTANCE LEARNING
In the Fall of 1992 the instructor recorded 14 one and a half hours of lectures for CIS 113 while teaching the honors section in NJIT’s Candid Classroom. Students taking the distance learning version of the course have been using these tapes since the Spring semester of 1993. On campus students also have also taken advantage of the tapes and are using them in the university Library for review after lectures.
During the Spring semester of 1994, the Virtual Classroom course was offered in accelerated mode for the first time. In the Fall of 1994, two VC sections of the same course were offered: regular and honors. In all of these sections, students would “sit in” on the lectures by either watching them on CTN or by tape circulation arranged by the Office of Distance Learning. All class interaction and correspondence with the instructor took place through the Electronic Information Exchange System (EIES) conferencing component.
Three face-to-face sections of CIS 113 were also offered during both of these two semesters. The VC instructor was also the on-campus instructor.
THE VIRTUAL CLASSROOM COMPONENT OF CIS 113
Computerized Conferencing
Students were initially sent a comprehensive package from the Office of Distance Learning describing the project, the program, plus an EIES manual and information, and an initial survey. Also included in this package were additional information from the instructor: a welcome letter, a class syllabus, and a list of required readings for the course. Items related to the course were also posted in the course conference at the beginning of the semester. Students were added to the conference as soon as they received their login accounts.
Initial discussions and interactions were generated as a result of the posting of an opening statement as the first item of the conference (Appendix 2 contains the opening statement) and instructor’s self introduction. Students were asked to use the reply option of EIES to respond with their self introduction and other relevant information. Also a self-help assignment on using the basic functions within EIES was assigned. These two activities allowed the students to discover some necessary functions of EIES that were essential for the rest of the semester.
Conference interaction, throughout the semester, was both required and spontaneous. Each week, a detailed introduction to the week's lesson was posted in the conference, as well as the required reading (chapters and section) for the week (Appendix 3 contains samples of weekly topic introductions and assigned readings). An electronic problem solving session, involving the instructor and the students, was held every other week (Appendix 4 contains a complete sample problem solving session as developed by the instructor and students). Students were required to sign on the system at least twice a week, preferably after seeing the appropriate two video tapes of the week, and after reading the corresponding book chapter (s).
As a mean of “attendance” verification and to increase interaction, students were required to submit a weekly "class participation" assignment. This assignment consisted of the student posting a conference comment critiquing the subject matter discussed in the video and weekly reading. Students were encouraged to comment on the discussions submitted by fellow students and to encourage this communication the instructor commented on each student’s weekly discussion. This requirement proved very successful. Students rarely “missed” classes, and when they did the work was made up with class participation.
Five programming projects were assigned. The last two involved group work. Due dates were based upon the complexity of the assignment and the class section (honors, accelerated, etc.) Rules regarding assignments were posted in the conference.
Students were to mail assignments on or before due dates. Assignments were reviewed for their strengths and weaknesses. Students were sent a private mail feedback message including comments on their solution as well as a grade. A version of the instructor’s solution was posted in the conference after the due date. Students comments on the instructor’s solution were encouraged.
Midterm and final exams were given on campus. Students who lived more than 100 miles from the campus were permitted to have the exam proctored (at workplace, other schools, etc.). Proctoring, however, was the exception rather than the rule. Exam dates and times were posted regularly. A week before the exam, a conference item that discussed the material to be covered was posted. This allowed the students to ask questions concerning a particular subject or problem.
The Problem Solving Session
Though initially intended to be an exercise in program development, the problem solving session became the heart of conferencing activities. Such sessions, students commented, helped them feel that “there was actually a classroom”.
A sequence of well defined "activities" makes up a complete problem solving session. The session begins with the examination of a problem to be solved. With the introduction of the problem as the first activity of the session, we allow the students to engage in analyzing and defining the variables of the problem and to seek, discuss, and present possible solutions. The students concentrate and focus on the design of the algorithms, choice of data types and structures, and outlining the testing strategies. Once the algorithmic solution for the problem is constructed, the language syntax (i.e. control structures, data representation) necessary to carry out the solution to its final stages is then recalled (already introduced in the lecture tapes). This is accomplished by what we refer to as the algorithmic walkthrough. Each line in the algorithm is visually scanned, by the students and the instructor, to identify all new language features required in order to have a complete mapping of the algorithm into the language’s syntax. Using both the algorithmic solution which the students develop in collaboration with the instructor and the language’s grammar - now more meaningful and appreciated - the complete solution is implemented and tested.
This makes it possible for the students to get involved in class discussions from the beginning and throughout the duration of the problem solving session.
Statistical Information: Comparison of All Section Results
In Spring 1994, 5 sections of CIS 113 were offered: 2 face-to-face (ftf) sections, a distance learning section with video tape circulation only (dl), a VC plus video accelerated section (acc), and an evening section (eve).
In Fall 1994, 6 sections of CIS 113 were offered: 3 face-to-face (ftf) sections, a VC plus video regular section (reg), a VC plus video honors section (hon), and an evening section (eve).
Below is the grade comparison from all section of CIS 113 taught by the same instructors (on-campus day/VC honors/VC accelerated/VC Regular/on- campus evening.
_____________________________________________________________________________ SP 94 GRADE ftf sec 1 sec 2 dl VC (acc) eve A’s 1 4 -- -- 3 B+’s -- 1 -- 5 -- B’s 2 -- 1 -- 3 C+’s 4 2 -- -- 1 C’s 2 4 1 2 3 D’s -- -- 1 -- 5 F’s 5 5 1 1 5 W’s 9 2 3 -- 11 Inc’s 0 0 -- 1 -- Total 23 18 7 9 31 _____________________________________________________________________________ Fall 94 GRADE ftf sec 1 sec 2 sec 3 VC (reg) VC (hon) eve A’s 3 4 4 -- 4 4 B+’s 4 1 3 -- 2 -- B’s 5 2 3 2 3 3 C+’s 1 3 1 2 -- 2 C’s 2 2 4 -- -- -- D’s 2 2 1 3 -- 2 F’s 7 5 1 2 -- 5 W’s 3 2 4 4 2 4 Inc’s 1 -- -- 1 -- -- Total 28 21 21 14 11 20 _____________________________________________________________________________ GRADE VC ftf dl A’s 4 12% 23 14% 0 0% B+’s 7 21% 9 6% 0 0% B’s 5 15% 18 11% 1 14% C+’s 2 6% 15 9% 0 0% C’s 2 6% 17 10% 1 14% D’s 3 9% 12 7% 1 14% F’s 3 9% 33 20% 1 14% W’s 6 18% 35 20% 3 43% Inc’s 2 6% 1 1% 0 0% Total 34 163 7 3 sections 7 sections 1 section ______________________________________________________________________________ GRADE VC ftf dl Total A’s and B’s 16 50 1 67 C’s and D’s 7 44 2 53 F’s 3 33 1 37 W’s 6 35 3 44 Total 32 162 7 201 3 sections 7 sections 1 section ______________________________________________________________________________ GRADE VC ftf dl Total A’s and B’s 10.7 54 2.3 67 C’s and D’s 8.4 42.7 1.8 53 F’s 5.9 29.8 1.3 37 W’s 7.0 35.5 1.5 44 Total 32 162 7 201 3 sections 7 sections 1 section ______________________________________________________________________________
Collapsing the data to make possible a significance test, we obtain the results below. Those sections using the Virtual Classroom are significantly more likely to obtain an A or B in the course than those in traditional ftf or all video sections. Those in video only are significantly more likely to withdraw.
| Mode | A or B | C or D | F | W | Total |
| VC+ Video | 50% | 22% | 9% | 19% | 32 = 100% |
| FtF | 31% | 27% | 20% | 22% | 162 = 100% |
| Video only | 14% | 29% | 14% | 43% | 7 = 100% |
| All | 67 | 53 | 37 | 44 | 201 = 100% |
| Chi Sq = 7.43 p= .30 | |||||
TEACHING IN THE VIRTUAL CLASSROOM VS THE TRADITIONAL CLASSROOM
One of the obstacles to learning is the inability or unwillingness of students to grasp course content. In the traditional classroom setting, the instructor has opportunities to facilitate the learning process directly and indirectly through language, gestures, reinforcement material, and peer pressure. Such support mechanisms do not, for the most part, exist for the typical distant learner who, isolated, acquires information from videotapes, electronic and print material. However, as an instructor who is always willing to try new and different techniques and modes of teaching and learning, and based on my personal experience, I remain persuaded by the needs of the changing student population that the virtual classroom is one of the answers.
Several factors from which students benefit are to be taken into consideration:
SUMMARY
Technological applications in education are providing for an improved response to the demands of the changing student population. Televised and computerized media are permitting an increasing number of remote students to take better advantage of a wide variety of educational opportunities. Efforts must be geared toward maintaining a reasonably consistent learning environment and achieving parity with on-campus programs. The delivery of services beyond lecturing and electronic discussions is an area that must be addressed.
Distance learning has become a household word. Business organizations, telephone companies, cable and public broadcasting companies, and educators have placed it high on their agendas for the twenty first century. For those of us who are already providers of distance learning, we must find some answers for some important questions. We know that we can deliver rigorous programming to remote students because we have been doing it. We know that access issues are receding with the deployment of new and somewhat affordable telephone technologies. Furthermore, we know that distance learning offers more flexibility in meeting the needs of diverse learning styles and that most distant learners prefer to learn when it is convenient for them, i.e. in delayed time frames, rather than when it is convenient for the college, i.e. at a specific time or a specific place. The consequences of increased access, increased enrollment and demand for flexibility in educational programming delivery pose problems with faculty/student interaction, course pacing, deadlines, and assessment. Thus, distance learning posits great risks to the management of education. These risks challenge the faculty mentor who is conducting the courses as well as the students who are enrolled.
The most critical next step in the evolution of distance learning is the development of management strategies which counteract this welcome flexibility so that learner and teacher have a constant sense of who is learning what and when.
CIS 113 Introduction to Computer Science I
Course Syllabus for the Virtual Class
Fall 1995
1. Opening Note
This section of CIS 113 is offered via a combination of video and "Virtual Classroom". The material covered will be the same as in the regular sections of CIS 113. In the past students have found the material and the workload in this course rather challenging. Therefore, a substantial time investment into the course, on the order of 10 hours a week or more must be expected (this includes watching the tapes, participating in the electronic conference discussions, and doing the homework and projects).
Students are requested to meet on campus for an orientation session and two examinations unless it is not feasible geographically (student lives in a different part of the country or over 100 miles away from NJIT). Pretaped lectures will be broadcast via TV (or tape circulation). Discussions, weekly homework, and assignments will take place continuously in the Virtual Classroom, NJIT's computerized conferencing system. You will be expected to sign on-line at least two times a week using your PC and a modem or a terminal, if you are on campus.
2. Personnel
Instructor: Maura Ann Deek Office: 4400 Guttenberg Information Technologies Center (GITC) Phone: 596-3366 Office Hours: online E-mail: 2085 or maura (EIES account)
3. Course Overview
Title: CIS 113 Introduction to Computer science I
Credits: 3
Co-requisite: Math 111
Description: Fundamentals of computer science are introduced, with emphasis on programming methodology and problem solving. Topics include basic concepts of computer systems, software engineering, algorithm design, programming languages and data abstraction, with applications. A high level language (such as Pascal) serves as the vehicle to illustrate many of the concepts. CIS majors should enroll in CIS 113. Students who receive degree credit for CIS 113 may not receive degree credit for CIS 213.
Goals: To understand the structure and use of a computer system including the various software and hardware support facilities that are available, and the internal representation of information and the underlying concepts in number system, and radix conversion;
To introduce a disciplined approach to problem solving, algorithm development and program construction by use of top-down design techniques, including modular construction and stepwise refinement;
To teach a block-structured high-level programming language;
To describe the application and implementation of advanced programming techniques and data structures;
To teach program design, coding, debugging, testing and documentation using good programming style;
To provide a foundation for further studies in Computer Science.
4. Topics (not necessarily in broadcast order)
1. Computer systems: Hardware Components (central processing unit, control unit, memory, input and output devices, and representation of information). Software (language translators, operating systems functions and characteristics, and other applications).
2. Problem solving and programming methodology (specification, design, implementation, and testing).
3. Basic types and operations.
4. Control structures (sequencing, selection and repetition).
5. Modular Design and abstraction (sub problems, scope, module interface, and recursion).
6. Software engineering (design quality, coupling, cohesion, and correctness).
7. Data abstraction, simple data types and sets.
8. Lists (static): One, two and multi-dimensional.
9. List applications: Searching and sorting.
10. Data structures: records, data abstraction, and files.
11. Lists (dynamic) and implementation of abstract data types as data structures.
12. Linked vs. linear storage; tradeoffs in space, flexibility, and speed.
13. Operations on data structures such as insertion, deletion, and traversals.
5. Textbooks
1. Brookshear, Computer Science: An Overview, Addison-Wesley, Fourth Edition, 1994.
2. Savitch, TURBO PASCAL, Addison-Wesley, Fourth Edition, 1993.
6. Assignments
Viewing:
The lecture part of this class will be broadcast by CTN (see above). If you cannot see the broadcast at that time, you must make sure that you see the corresponding Video Tapes by THURSDAY of the same week (feel free to tape the lessons for delayed viewing).
There will also be a room in the NJIT Library where you can view the tapes. More information on that will be posted in the conference.
Reading:
It is required that you read the textbook chapters in the above books after you watch the corresponding classes on Tape or CTN. Reading assignments will be posted on a weekly basis. There are some material covered in the book and will be the basis of electronic discussions, but are not on the tapes.
Homework:
Homework are of three kinds:
a) Weekly participation. Conference comments about what you learned from each week's lesson
(the taped lecture and the reading assignment), what you liked most and least about this week's
lesson, etc.
b) Interaction homework. There will be periodic problem solving sessions that require everyone's input and will be held after the second broadcast of the week. Your prompt answer will be expected (more details and deadlines will be announced on the system).
c) Programming projects. There will be 5 Pascal programming projects also posted on the system to be submitted electronically.
7. Examinations There will be a midterm and a final exams to be taken on the NJIT campus. Exact dates, time, and location will be communicated electronically.
8. Grading
Midterm 25 % Final 30 % Interaction homework and class participation: 25 % Programming projects: 20 %
For exceptionally well done work a number of extra credit points will be given.
9. Late policies
Due to the nature of this course, no late Interaction Homework will be accepted (unless you have a good reason, such as documented illness). For programming assignments there will be late penalties for late submissions. Details will be announced in the assignment.
10. Academic Integrity
The work you do and submit is expected to be the result of your effort ONLY. You may discuss the high level (general) solution of a problem. However, cooperation should not result in one or more students having possession of a copy of all or part of a program written by another student. The penalty for violating the University's code may include failure in the course and probation.
11. Tutoring (if you are on campus)
There is help available in this class beyond the electronic boundaries. The instructor and the TA can answer any question related to topics covered on the tape, the conference, or the textbook, programming assignments, or any other related questions. Additionally, structured tutoring sessions for students who request it or need it is also available.
The CIS department runs a tutorial center located in room 4315 INFO. Tutors will help students with troublesome program problems.
The University Learning Center located in University Hall also runs a comprehensive tutorial program. Tutors at the center will assist the students in course and homework related problems and provide them with tutorial sessions.
12. Computing Needs
You will be using Turbo PASCAL on your NJIT PC (or any other PC available to you).
13. Time Schedule (CTN broadcast)
Tuesdays and Wednesdays, 3:30am to 4:00am, starting September 5 to December 13. On December 13, the lecture will air starting at 2:30 am to 4:00 am.
14. Broadcast Details
The course will cover 2 lessons per week (topics can be found in text 1 and 2 described above) in the following order. More on readings will be communicated electronically.
Lessons 1,2 Computer Organization and Operating Systems Lessons 3,4 Introduction to Problem Solving and Programming Lessons 5,6 Input, Output and Program Construction Lessons 7,8 Modular Design and Abstraction Lessons 9,10 Control Structures: Sequencing, Selection and Repetition Lessons 11,12 More on Modular Design and Programming Lessons 13,14 Software Engineering Lessons 15,16 More on Control Structures: Selection and Repetition Lessons 17,18 User Defined Structures Lessons 19,20 Data Structures: Lists Lessons 21,22 List Applications: Searching and Sorting Lessons 23 Character Arrays, Strings and the Packed Option Lessons 24 More on Data Structures: Records Lessons 25 More on Data Structures: Files Lessons 26 The Pointer Type Lessons 27,28 Dynamic Structures: Linked Lists Lessons 29,30 More on Dynamic Structures
15. Orientation Session
Remember that you MUST attend the orientation session on Tuesday September 5, 1995 from 4:00pm to 6:00 in the Guttenberg Information Technologies Center (GITC), room 4325, as described in the attached letter.
Welcome to the Virtual Classroom of CIS 113 - Introduction to Computer Science I
The goals of this course include a solid foundation to many of the important concepts to which students will be exposed to in their course of study. The outline for this foundation course covers the following basic areas:
We introduce problem solving techniques that are particularly useful in using a computer in a problem's solution. This is called programming. It is important, however, to realize that we, and not the machine, have the biggest burden of the problem solving task.
Distinguishing between the planning and designing phase on one hand and the coding (programming) phase on the other will help alleviate a typical problem: writing code without a clear understanding of the problem definition and/or its requirements that can and will often result in erroneous outcome.
We do not attempt to present programming language syntax at the same time we teach problem solving techniques and algorithm development. We cover the language syntax once we have identified our needs.
The organization of data is also an important aspect of the problem solving/implementation. Without a clear picture of the organization of internal storage, it is difficult to visualize how data is represented, stored and referenced within computers.
Regardless of the language used, it is more meaningful that problem solving be taught in parallel with the language syntax - not after. We use an English-like pseudocode language for presenting algorithm development and representation. This will enable us to produce an initial design and possible solution that is language independent and hence simple to develop.
As the course progresses, we should keep four important objectives in mind:
1. Laying a solid foundation in the areas of computer systems, problem solving and algorithm development, data structures, and program development.
2. Making a language-independent presentation of problem solving and data structures.
3. Keeping the discussion of computer system and problem solving concepts independent of any specific machine architecture and software tools.
4. Acquiring the skills to design, develop, document, test, and maintain programs.
Finally, no mathematical background is assumed in order to understand the material presented in this course. However, the curriculum requires that calculus I is a corequisite of this course, since the skills of forming and manipulating abstractions and in using analogy are very important in understanding the material presented here and in the following courses.
The following is a introduction of the fifth week's broadcast:
Lessons 9 and 10 discussed Control Structures: Sequencing, selection and repetition. The notion of flow of control through a program refers to the order in which statements are executed. Although execution proceeds according to the actual order in which statements appear (sequential), it is often the case where the control flow may diverge and take on a logical path that is different from the physical one. In addition to the sequential control structure; selection and repetition are the three basic control structures common to all programming languages.
Frequently, the execution of a process depends on the logical outcome of a conditional expression (i.e. true or false). As a result, different actions may be taken. Programming languages use selection control structure to instruct the computer to determine which of the possible two cases is actually in effect, and to specify the action to be taken in each case. Selection can be one-way, two-way, or multi-way.
Repetition is a control structure that allows a process to be executed repeatedly, also based on a condition, during the program execution. There are numerous ways to control repetition including counting and event mechanisms. An important fact that must be verified and determined with repetition is the termination condition, otherwise the process of repeating could go on indefinitely.
Please read the following sections:
Lesson 9, 10 Control Structures: Sequencing, Selection and Repetition
Text 1: Ch 5 Sec. 5.1-5.4
Text 2: Ch. 3
Text 1: J. G. Brookshear, "Computer Science: An Overview"
Text 2: W. J. Savitch, "Turbo Pascal"
What follows is a sample problem solving session as it is conducted in the conference. Each activity is labeled as a heading. The role of students and instructor are described and a selected brief example of the activity’s output is included. The subject of this lesson is the selection control structure. This topic is generally covered in the second week of the semester.
The activities are as follows:
INTRODUCTION (Instructor starts by an introduction to the topic to be covered)
Example:
The notion of flow of control through a program refers to the order in which statements are
executed. Although execution proceeds according to the actual order in which statements
appear (sequential), it is often the case where the control flow may diverge and take on a logical
path that is different from the physical one. In addition to the sequential control structure;
selection and repetition are the three basic control structures common to all programming
languages.
Frequently, the execution of a process depends on the logical outcome of a logical expression (i.e. true or false). As a result, different actions may be carried out. The selection control structure is used to instruct the computer to determine which of the possible two cases is actually in effect, and to specify the action to be taken in each case. Selection can be one-way, two-way, or multi-way.
PRESENTATION OF PROBLEM (Instructor presents a problem that is intended to take into consideration the use of new material as defined in the syllabus for that specific week)
Example:
As we all know, updating a checkbook (Balancing) is a task that some of us struggle with and
others dislike. Luckily, we are learning about problem solving and programming now. Today we
are going to computerize this annoying task at once.
ANALYSIS AND SPECIFICATIONS (Students with instructor acting as facilitator discuss and document problem input, calculations, identify required formulas, and expected outcome)
Example:
1. Discussions
First we need to know the transaction type, the starting balance, and the transaction amount. Once this is entered, calculations consistent with the transaction type (deposit or withdrawal) will take place. Finally, the result is displayed.
2. Data requirements
a) Input
Transaction type (character), starting balance (numeric), transaction amount (numeric).
b) Output
Transaction type (character), starting balance (numeric), transaction amount (numeric), ending
balance (numeric).
c) Intermediate data
None
d) Named constants
None
3. Relevant formulae
For deposit:
ending balance = starting balance + transaction amount
For withdrawal:
ending balance = starting balance - transaction amount
DESIGN (Students with instructor acting as facilitator perform several tasks starting with: 1) identifying all system components (modules) graphically using a design methodology such as top-down and step wise refinement techniques. 2) define each module specification including task to be carried out, input/output, and logic. 3) a possible solution outline is formed using an algorithmic language notation)
Example:
1. Structure chart
First-level refinement
Update
checkbook
|
|--------------+-------------|
| | |
Get Perform Display
data computation results
Second-level refinement
Get
data
|
|---------------+---------------|
| | |
Get Get Get
starting transaction transaction
balance type amount
Perform
computations
|
|
Determine
balance
Display
results
|
|---------------+----------------|
| | |
Print Print Print
starting transaction ending
balance balance
Third-level refinement
Print
transaction
|
|-----------------------|
| |
Print Print
starting ending
balance balance
2. Module specifications:
As an alternative method to further aid in understanding how data are transmitted, we will include module specifications for each main (first-level) module. Each module specifications include a description of data received, information returned, and logic used in the module.
Module specifications for the Get Data module are:
For the Update checkbook problem, complete module specifications are
1. Get data
2. Perform computations
3. Display results
A second-level development produces
1. Get data 1.1 get starting balance 1.2 get transaction type 1.3 get transaction amount 2. Perform computations 2.1 IF deposit THEN add to balance ELSE subtract from balance 3. Display results 3.1 print starting balance 3.2 print transaction 3.3 print ending balance
Step 3.2 of the algorithm is subdivided into
3.2 print transaction 3.2.1 print transaction type 3.2.2 print transaction amount
ALGORITHMIC WALKTHROUGH (Students attempt to map the algorithmic solution into programming language syntax by going over each line in the algorithm and pointing out the exact language feature required))
Example:
2.1 IF deposit THEN add to balance ELSE subtract from balanceIMPLEMENTATION (Students and instructor attempt to fill in the gaps and produce a complete program that will run on the computer)
Example:
PROGRAM Checkbook (input, output);
VAR
StartingBalance, EndingBalance, TransAmount : real;
TransType : char;
BEGIN { Main Program }
{ Module for getting the data }
writeln ('Enter the starting balance and press .');
readln (StartingBalance);
writeln ('Enter the transaction type (D) deposit ',
'or (W) withdrawal');
writeln ('and press .');
readln (TransType);
writeln ('Enter the transaction amount and press .');
readln (TransAmount);
{ Module for performing computations }
IF TransType = 'D'
THEN
EndingBalance := StartingBalance + TransAmount
ELSE
EndingBalance := StartingBalance - TransAmount;
{ Module for displaying the results }
writeln;
writeln ('Starting Balance $', StartingBalance:8:2);
writeln ('Transaction $', TransAmount:8:2,
TransType:2);
writeln ('---------':45);
writeln ('Ending Balance $', EndingBalance:8:2)
END. { of main program }
Notice how sections of the program correspond to module specifications. Sample runs of the
program produce the output:
Enter the starting balance and press
235.16
Enter the transaction type (D) deposit or (W) withdrawal and press
D
Enter the transaction amount and press
75.00
Starting Balance $ 235.16
Transaction $ 75.00 D
-------
Ending Balance $ 310.16
Enter the starting balance and press
310.16
Enter the transaction type (D) deposit or (W) withdrawal and press
W
Enter the transaction amount and press
65.75
Starting Balance $ 310.16
Transaction $ 65.75 W
-------
Ending Balance $ 244.41