Fundamentals Of Programming PDF
Document Details
National University
Jesfer M. Dela Cruz
Tags
Summary
This document is a presentation on the fundamentals of programming, including basic programming terminology, problem-solving phases, algorithms, pseudocode, and flowcharts. A sample question and flowchart are also included.
Full Transcript
INTRODUCTION TO COMPUTING Course Code: CCINCOM/L FUNDAMENTALS OF PROGRAMMING Department of IT College of Computing and Information Tech...
INTRODUCTION TO COMPUTING Course Code: CCINCOM/L FUNDAMENTALS OF PROGRAMMING Department of IT College of Computing and Information Technologies (CCIT) National University Prof. Jesfer M. Dela Cruz Faculty Joseph Marvin R. OF FUNDAMENTALS Imperial PROGRAMMING NU College of Computing and Information Technologies Course Code: CCPRGG1L Learning Objectives To review and explain the following: ▪ Define Basic Programming Terminology ▪ Determine Problem-Solving Phase ▪ Create and Solve problems using Algorithm, Pseudocode and Flowchart FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Introduction to Programming Computer Programming It is the act of writing computer programs, which are a sequence of instructions written using a Computer Programming Language to perform a specified task by the computer. Computer Programming is FUN and EASY TO LEARN provided you adopt to a proper approach. FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Introduction to Programming Computer Program It is a sequence of instructions written using a Computer Programming Language to perform a specified task by the computer. The two important terms that we have used in the above definition are: ▪ Sequence of instructions ▪ Computer Programming Language FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Introduction to Programming To understand these terms, consider a situation when someone asks you about how to go to a nearby Jollibee Branch. What exactly do you do to tell the way to go to Jollibee? Naturally, you will use Human Language to tell the way to go to Jollibee, something as follows: FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Introduction to Programming Here is an example of instruction that you can give which involved several steps for them to be able to reach the nearby Jollibee branch. They can successfully reach the destination if they followed this in sequence. 1. Go straight and drive half kilometer. 2. Take left on the first corner that you will see. 3. Search for the Jollibee branch at your right side. FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Introduction to Programming FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Data Source Aggregated statistics from several indexes, GitHub repository access, multiple surveys FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Introduction to Programming Uses of Computer Programs Today computer programs are being used in almost every field, household, agriculture, medical, entertainment, defense, communication, etc. Listed below are few applications of computer programs: ▪ MS Word, MS Excel, Adobe Photoshop, Internet browser, etc. are examples of computer programs. ▪ Computer programs can be used in our gadgets and phones. FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Introduction to Programming Computer Programmer Computer programs are created by the person who are skilled to write computer code. They are called a “COMPUTER PROGRAMMER.” Commonly a computer programmer can be named based on the computer programming language expertise such as: Java Programmer, C++ Programmer, Python Programmer, PHP Programmer, and Ruby Programmer to name a few common languages nowadays. FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase The student must read the problem statement several times to ensure that he/she understands what is asked before attempting to solve the problem. The following steps need to be followed: ▪ Read the problem carefully. ▪ Understand what the problem entails. ▪ Only then, write down the steps to solve the problem. FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Algorithm From programming point of view, an algorithm is a step-by-step procedure to resolve any problem. An algorithm is an effective method expressed as a finite set of well-defined instructions. Thus, it can be very helpful if computer programmer lists down all the steps required to resolve a problem before writing the actual code. FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Algorithm The word is derived from the phonetic pronunciation of the last name of Abu Ja’far Mohammed ibn Musa al-Khwarizmi, who was an Arabic mathematician who invented a set of rules for performing the four basic arithmetic operations (addition, subtraction, multiplication and division) on decimal numbers. FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Pseudocode Pseudocode is a logic development tool that uses English statements or clauses to present the logical steps necessary to solve a problem. “Pseudo” technically means “false”, so pseudocode, taken literally, means “false code”. This is used in program development, pseudocode is made up statements written to depict steps, in the correct sequence, required to solve a specific problem. References Minhas, S. (2021). Pseudo Code. Retrieved from PDFCOFEE: https://pdfcoffee.com/pseudo-code-4-pdf-free.html FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Pseudocode It is composed of words, clauses and sentences. The following rules should be followed: ▪ No actual programming code should appear n the pseudocode. You just need to write down the logical steps at this stage, not coding the program ▪ All statements should be presented in enough detail so the reader can clearly understand the activity or action being described in each statement. References Minhas, S. (2021). Pseudo Code. Retrieved from PDFCOFEE: https://pdfcoffee.com/pseudo-code-4-pdf-free.html FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Pseudocode ▪ The names of “variables” being used to solve the problem should be totally descriptive of what they represent, not shortened versions you use in your source code. ▪ Each activity or action being depicted should be presented in a single line. Appropriate indentation should be used if the activity or action being described cannot fit on one line. ▪ Indentation should be used where appropriate to show the logical grouping of related activities or actions. References Minhas, S. (2021). Pseudo Code. Retrieved from PDFCOFEE: https://pdfcoffee.com/pseudo-code-4-pdf-free.html FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Pseudocode ▪ Most of your pseudocode should not be done with capital letters, but certain key structures should be capitalized. They are: IF, THEN, ELSE and ENDIF in decision structures. DO WHILE and ENDDO in pre-test loop structures. DO UNTIL and ENDDO in post-test loop structures. CASE and ENDCASE is a case structures. References Minhas, S. (2021). Pseudo Code. Retrieved from PDFCOFEE: https://pdfcoffee.com/pseudo-code-4-pdf-free.html FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Flowchart A flowchart uses special shapes to represent different types of actions or steps in process. These are known as flowchart symbols. This is a type of diagram (graphical or symbolic) that represents an algorithm or a process. It is typically showing the flow of data in a process, detailing the operations/steps in a pictorial format which is easier to understand than reading it in a textual format. References smartdraw. (n.d.). Flowchart Symbols. Retrieved from smartdraw: https://www.smartdraw.com/flowchart/flowchart-symbols.htm FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Common Flowchart Symbols Symbol Name Functions Terminal Indicates the starting or ending of a program, process, function, or interrupt program. Input/Output Used for any input or output operation. Indicates that the computer is to obtain data or output results. Process Indicates any type of internal operation inside the Processor or Memory. Decision Used to ask a question that can be answered in a binary format (yes/no, true/false). Predefined Process Used to invoked subroutine, function, or an interrupt program. Connector Allows flowchart to be drawn without intersecting lines or without a reverse flow. Flow Lines Shows direction of flow FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase General Rules for flowcharting ▪ All boxes of the flowchart are connected with Arrows. (Not lines) ▪ Flowchart symbols have an entry point on the top of the symbol with no other entry points. The exit point for all flowchart symbols is on the bottom except for Decision symbol. ▪ The Decision symbol has two exit points; these can be on the sides or the bottom and one side. ▪ Generally, a flowchart will flow from top to bottom. ▪ Connectors are used to connect breaks in the flowchart. FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase General Rules for flowcharting Connectors are used to connect breaks in the flowchart. Examples are the following: ▪ From one page to another page. ▪ From the bottom of the page to the top of the same page. ▪ An upward flow or more than (3) symbols. ▪ Subroutines and interrupt programs have their own and independent flowcharts. ▪ All flow charts starts with a Terminal or Predefined Process. ▪ All flowcharts end with a terminal or a contentious loop. FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L FLOWCHART (Mental Warm-Up) FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L 25 General Rules : Arrow Point N G CORRECT R O W X FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L 26 General Rules : Entry Point N G R O CORRECT W X FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L 27 General Rules : Exemption YES NO FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L 28 General Rules : Connector START WASH HAND WEAR MASK A FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L 29 General Rules : Connector A WEAR FACE SHIELD GO OUTSIDE END FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Basic Structures of Flowchart FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Sequence Structure The sequence structure is just a series of processes carried out one after the other. Each instruction is executed in a serial manner, one after another. TELL ME. What are the things you do to attend my class on time? Scan this QR code with your mobile device to record your answer in Recitation #1. FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L RECITATION # 1 1. Wake up. 2. Get out of bed. 3. Take a bath. 4. Put on my clothes. 5. Open the computer. 6. Join the class. FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L RECITATION # 1(Flowchart) START Wake up. Get out of bed. Take a bath. Put on my clothes. Open the computer. Join the class. END FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L PROBLEM SOLVING PHASE (Mental Warm-Up) FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Sequence Structure Pseudocode Flowchart DO Start GET number1 GET number2 answer = number1 / number2 Get number1 DISPLAY answer ENDDO Get number2 answer = number1/number2 Display answer Stop FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Sequence Structure Algorithm Flowchart 1. Get (Read) x, y, z Start 2. Compute Sum (S) as x + y + z 3. Compute Average (A) as S / 3 4. Compute Product (P) as x * y * z Get x, y, z 5. Display (Write) the Sum, Average and Product S = x +y + z A=S/3 P=x*y*z Display S, A, P Stop FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L Problem-Solving Phase Sequence Structure This problem statement is very simple. Once I have read it and understand what is asked for. I need to write down the steps to satisfy the requirement. TELL ME. Do you understand the Problem-Solving Process? Scan this QR code with your mobile device FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L END OF POWERPOINT PRESENTATION FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L References RESOURCES Online Resource 2021 https://www.tutorialspoint.com/computer_programming/computer_pr ogramming_overview.htm Farell, Joyce 2015 Java Programming FUNDAMENTALS OF PROGRAMMING Course Code: CCPRGG1L