The document provides information about the COMP 102 Programming I course for spring 2012. It includes the instructor's contact information, class meeting times, grading criteria, attendance policy, and academic honesty policy. It also lists the topics that will be covered in the course, such as programming concepts, flowcharts, pseudocode, and Java programming.
A Beginner’s Guide to Programming Logic, Introductory
Chapter 1
An Overview of Computers and
Programming
Objectives
In this chapter, you will learn about:
- Computer systems
- Simple program logic
- The steps involved in the program development cycle
- Pseudocode statements and flowchart symbols
- Using a sentinel value to end a program
- Programming and user environments
- The evolution of programming models
COURSE TECHNOLOGY
CENGAGE Learning
A Beginner’s Guide to Programming Logic, Introductory
Chapter 2
Working with Data, Creating Modules, and Designing High-Quality Programs
Objectives
In this chapter, you will learn about:
- Declaring and using variables and constants
- Assigning values to variables
- The advantages of modularization
- Modularizing a program
- The most common configuration for mainline logic
COURSE TECHNOLOGY
CENGAGE Learning
A Beginner’s Guide to Programming Logic, Introductory
Chapter 1
An Overview of Computers and
Programming
Objectives
In this chapter, you will learn about:
- Computer systems
- Simple program logic
- The steps involved in the program development cycle
- Pseudocode statements and flowchart symbols
- Using a sentinel value to end a program
- Programming and user environments
- The evolution of programming models
COURSE TECHNOLOGY
CENGAGE Learning
A Beginner’s Guide to Programming Logic, Introductory
Chapter 2
Working with Data, Creating Modules, and Designing High-Quality Programs
Objectives
In this chapter, you will learn about:
- Declaring and using variables and constants
- Assigning values to variables
- The advantages of modularization
- Modularizing a program
- The most common configuration for mainline logic
COURSE TECHNOLOGY
CENGAGE Learning
Problem analysis, Algorithms and Flowchart, Coding, Compilation and Execution, History of C, Structure of C program, Debugging, Testing and Documentation
https://github.com/ashim888/csit-c
A Beginner’s Guide to Programming Logic, Introductory
Chapter 3
Understanding Structure
Objectives
In this chapter, you will learn about:
- The features of unstructured spaghetti code
- The three basic structures—sequence, selection, and loop
- Using a priming input to structure a program
- The need for structure
- Recognizing structure
- Structuring and modularizing unstructured logic
COURSE TECHNOLOGY
CENGAGE Learning
Problem analysis, Algorithms and Flowchart, Coding, Compilation and Execution, History of C, Structure of C program, Debugging, Testing and Documentation
https://github.com/ashim888/csit-c
A Beginner’s Guide to Programming Logic, Introductory
Chapter 3
Understanding Structure
Objectives
In this chapter, you will learn about:
- The features of unstructured spaghetti code
- The three basic structures—sequence, selection, and loop
- Using a priming input to structure a program
- The need for structure
- Recognizing structure
- Structuring and modularizing unstructured logic
COURSE TECHNOLOGY
CENGAGE Learning
1. 1
COMP 102:
PROGRAMMING I
SPRING 2012
Material is based on
*Programming Logic and Design, Fifth Edition, Comprehensive Chapter 1
* Introduction to Programming in C++: Algorithms,Flowcharts and Pseudocode by Brent
Daviduck
2. Course Outline
Instructor Information:
Name Ms. Saira Anwar
Email
SairaAnwar@fccollege.edu.pk
SairaAnwar@hotmail.com
Office S – 211
Office Hours
Monday, Wednesday 10:00 – 11:00
Tuesday, Thursday 11:00 – 12:00
Class Meet Tuesday, Thursday 9:00 – 10:50 AM
Category
•Core course for all Computing Majors
•Recommended General Education Course for students with
some enthusiasm to learn programming and who want to feel real
flavor of writing a program
Pre- Requisite Nil
Website https://sites.google.com/site/comp102seca/
3. Course Outline
Text Book
Java in Two Semesters by Quentin Charatan and Aaron Kans
Java 6 Illuminated Second Edition By Julie Anderson, Herve Franceschi
Reference Books
Art and Science of Java by Eric Roberts
Thinking in Java, by Bruce Eckel
Java, The Complete Reference, by Patrick Naughton, Herbert Schildt
Java and Object Orientation: An introduction, John Hunt
The Java Handbook , by Patrick Naughton, Michael Morrison
Java in a Nutshell: A Desktop Quick Reference for Java Programmers , by
David Flanagan
The Java Language Specification , by James Gosling , Bill Joy, Guy Steele
Who's Afraid of Java?, by Steve Heller
4. Course Outline
Grading:
Lab Quiz (Consider them 45%
exams)
Assignments and Quiz 7%
Project 7%
Group Quiz 1%
Mid (Out of class) 20%
Final 20%
Total 100.00%
•REGRADING CAN BE REQUESTED WITHIN
FOLLOWING TIME LIMITS:
QUIZZES AND HOMEWORKS: 2DAYS, EXAMS: 3DAYS
5. Course Outline
Attendance and Quiz Policy:
•Attendance in class is mandatory.
•Inadequate attendance (less than 85%)
may lead to disqualification from the
Midterm and/or Final Exams.
•Take attendance on random days.
•There could be both announced and un-
announced quizzes
•Deadlines are hard deadlines.
6. Course Outline
Academic Honest:
•What is plagiarism?
“Plagiarism is defined as presenting someone
else’s work as your own. Work means any
intellectual output, and typically includes
text, data, images, sound or performance.”
(Office of Academic Appeals & Regulation 2005)
Office of Academic Appeals & Regulation, 2005, Section 2.1 of
the published procedures on “ Cheating, plagiarism and
fraudulent or fabricated coursework ” (available online at
http://www.leeds.ac.uk/AAandR/cpff.htm - accessed 6th Aug
2005)
7. Course Outline
Plagiarism is serious:
•All cases are reported and go on your
student record.
•Penalties vary from written warnings, re-
sitting modules to expulsion from the
University.
•Why? – plagiarism undermines the
University’s reputation and the quality of its
degrees and research, plus plagiarists miss
out on learning!
9. Course Outline
References:
•“Write the text taken from others in double
quotes and italicize the text. Put referencec
at the end.”[1].
•If your ideas match to someone put
references [2].
•If you want to put multiple references. Put
them like it [3][4][5][6].
•You have to double quote the major terms
like “Software Engineering”.
10. Course Outline
“The only stupid question is the
one which is never
asked”[Unknown]
12. Understanding Computer
Components and Operations
12
Hardware and software: the two major
components of any computer system
Hardware: equipment, or devices
Software: programs that contain instructions for
the computer
Four major operations in a computer:
Input
Processing
Output
Storage
13. Program
Input (Data) PROGRAM Output (Results)
(Algorithm)
13
Takes some values as INPUT
PROCESS Them
Produce some result as OUTPUT
14. Programming Task
14
A typical programming task can be divided into
two phases:
Problem solving phase
produce an ordered sequence of steps that describe
solution of problem
this sequence of steps is called an algorithm
Implementation phase
implement the program in some programming
language
15. Understanding Computer
Components and Operations
15
Input devices: allow data to enter the computer
Mouse, keyboard, scanner
Processing: working on the data
Organizing data
Checking data for accuracy
Mathematical or other manipulations on data
Central Processing Unit (CPU): hardware that
performs the tasks
16. Understanding Computer
16
Components and Operations
Output devices: provide data to the user
Printer, monitor, speakers
Programming language: special language
containing instructions for the computer
Visual Basic, Java, C#, C++, COBOL
Syntax: rules governing word usage and
punctuation in the language
17. Understanding Computer
17
Components and Operations
Machine language: controls the computer’s on/off
circuitry
Compiler or interpreter: software that translates
programming languages to machine language
Program must be free of syntax errors to be run, or
executed, on a computer
To function properly, the logic must be correct
Algorithm = Syntax + Semantics
18. Understanding
18
the Programming Process
Six programming phases:
Understand the problem
Plan the logic
Code the program
Use software to translate the program to
machine language
Test the program
Put the program into production
19. Understanding the Problem
19
May be the most difficult phase
Users may not be able to articulate their needs
well
User needs may be changing frequently
Programmers may have to learn the user’s
functional job tasks
Failure to understand the problem is the major
cause of most project failures
20. Planning the Logic
20
Plan the steps that the program will take
Use tools such as flowcharts and pseudocode
Flowchart: a pictorial representation of the
logic steps
Pseudocode: Natural language representation
of the logic
Walk through the logic before coding by desk-
checking the logic
21. Pseudo Code and Flow Charts
21
Pseudo Code
Algorithms written in structural English
Good way to begin a solution design
Program flow is not always clear
Flow Charts
Graphical representation
Express flow of control
22. Using Software to Translate the
Program into Machine Language
22
Creating an executable program
23. Points to Note:
23
1. The process consists of repeated application of
simple steps
2. All steps are unambiguous (clearly defined)
3. We are capable of doing all those steps
4. Only a limited no. of steps needs to be taken
5. Once all those steps are taken according to the
prescribed sequence, the required result will be
found
6. Moreover, the process will stop at that point
38. What is a flowchart?
Flowcharts are one method for creating an
Algorithm.
They allow a process to be described in a
step-by-step manner.
Other Algorithm types are Pseudocode and
Prose.
39. Terminators
Start Oval Shape
One line in or out
Used to indicate the beginning
and end of a process
Stop
40. Data Boxes
Parallelogram shaped
Input One line in, One line out
Used to indicate the input or
output of data from the system.
Output
41. Process Boxes
Rectangle shaped
One line in, One line out
Used to indicate a process step
Process
42. Decision Boxes
Diamond shaped
One line in, two lines out
Must contain a binary
Yes/No question (Yes/No,
Question True/False, 0/1, etc)
Used to branch a program
dependent upon a condition
being met
43. Subprocess Box
Rectangle shaped, with
bars on the sides
One line in, One line out
Subprocess Used to include a
predefined process
44. Bad design…
What is wrong with this
chart?
The box has two lines in,
one line out…
Lines must join other
lines, never boxes!
45. Bad design…
What is wrong with this
flowchart?
Never use curved lines.
Always straight
Always vertical or
horizontal.
46. Remember…
Drawing flowcharts is actually easy.
Breaking tasks into small steps is often much
harder than it might seem.
If you can flowchart it, you can program it.
48. Flowchart for Computing sum,
product and average
48
Start
Start
Prompt the user and get
Prompt the user and get
number1 and number2
number1 and number2
sum = number1 + number2
sum = number1 + number2
product = number1 **number2
product = number1 number2
average =sum/2
average =sum/2
Print sum, product and average
Print sum, product and average
End
End
49. Flowchart for Computing circumference and
area of a circle
49
Start
Start
Prompt the user and
Prompt the user and
get radius of the circle
get radius of the circle
circumference = 2*3.14*radius
circumference = 2*3.14*radius
Area = 3.14*radius*radius;
Area = 3.14*radius*radius;
Print circumference and
Print circumference and
area of the circle
area of the circle
End
End
50. Flowchart for Computing min and max of 2
numbers
50
Start
Start
Prompt the user and get number1 and number2
Prompt the user and get number1 and number2
yes
number1 < number2 ?
number1 < number2 ?
no
min = number1
min = number1
min = number2
min = number2
max = number2
max = number2
max = number1
max = number1
Print min and max
Print min and max
End
End
51. Flowchart : Computing min of 3 numbers
51
Start
Start
Prompt the user and
Prompt the user and
get number1, number2 and number3
get number1, number2 and number3
yes
number1 < number2 ?
number1 < number2 ?
no
yes yes
number2 < number3 ?
number2 < number3 ? number1 < number3 ??
number1 < number3
no no
min = number3
min = number3 min = number2
min = number2 min = number3
min = number3 min = number1
min = number1
Print min
Print min
End
End
52. Flowchart Computing min of 3
numbers
52
Start
Start
Prompt the user and
Prompt the user and
get number1, number2 and number3
get number1, number2 and number3
min = number1
min = number1
yes
number2 < min?
number2 < min?
no min = number2
min = number2
yes
number3 < min?
number3 < min?
no min = number3
min = number3
Print min
Print min
End
End