COMP-20023_Computer-Programming-1 lesson 1

Page 1:

  • Introduction to computers, software, problem solving, and programming concepts

  • Objectives of the instructional material

  • Course material recommendations

Page 2:

  • Definition and explanation of computer hardware

  • Examples of computer hardware components

Page 3:

  • Definition and explanation of software

  • Types of software: system software and application software

  • Differences between software and hardware

Page 4:

  • Explanation of program and programming

  • Five-step process of programming: problem definition, program design, program coding, program testing, program documentation

  • Details of each step in the programming process

Page 5:

  • Errors in programming can be typographical or logic errors

    • Typographical errors are incorrect format or statements

    • Logic errors are caused by incorrect use of control structures

  • Documentation of the program is important for users, operators, and programmers

    • User documentation helps users understand how to use the program

    • Operator documentation guides computer operators when there is an error message

    • Program documentation helps train new programmers to maintain the system

  • Program logic formulation is the step-by-step development of a solution to a problem

    • Flowchart and algorithm are tools used in program logic formulation

Page 6:

  • Flowchart is a tool used in program logic formulation

    • Flowchart consists of boxes with instructions connected by lines

    • Symbols used in flowcharts include data, sequential access storage, direct access storage, documents, display, loop limit, terminal, input/output, processing, decision, arrowheads/flow lines, connector, and initialization/preparation

Page 7:

  • Types of flowcharts include system flowchart and program flowchart

Page 8:

  • System flowchart represents the flow of a targeted system as a whole

    • Example of a system flowchart is the computation of midterm grades

Page 9:

  • Program flowchart describes processing procedures based on detailed analysis

  • Flowchart development should be organized, understandable, and clear

  • Structured flowcharts are designed using three basic methods of control

    • Sequential method is the simplest, where steps are performed in a strictly sequential manner

Page 10

  • Selection Structure

    • One of several alternative actions is selected and executed

    • Uses decision based on the given condition

    • Uses decision block or the diamond-shaped block

    • Alternative action represented by a processing block

  • Figure 1-3 Flowchart that determines if the average of the student is "PASSING" or "FAILING"

    • START

    • AVE = 0

    • INPUT AVE

    • IF AVE > 75

      • YES

      • OUTPUT "PASSING"

    • NO

    • OUTPUT "FAILING"

    • STOP

Page 11

  • Figure 1-4 shows the flowchart that will determine the positive and negative number

    • START

    • A = 0

    • INPUT A

    • IF A < 0

      • YES

      • YES

    • NO

    • IF A == 0

      • OUTPUT "NEGATIVE"

    • OUTPUT "INVALID"

    • NO

    • OUTPUT "POSITIVE"

    • STOP

Page 12

  • Repetition Structure

    • One or more steps is performed repeatedly

  • Figure 1-5 Shows the flowchart for the printing of all odd numbers from 1-10

    • START

    • N = 0

    • ODD = 0

    • LOOP 1 TILL N = 10

      • IF ODD == 1

        • N = N + 1

        • ODD = N % 2

        • YES

        • OUTPUT N

      • NOPage 17

        • Activities/Assessments:

          • PROGRAMMING

            1. Write an algorithm(flowchart and pseudocode for the following problem.

              • PROGRAMMING EXERCISE 1-1

                • The volume of a rectangular box is given by the formula, V=length * width * height.

                • Design a program that will calculate and display the volume of a box whose dimensions are specified by the user.

            2. Prepare a program that converts hours to minutes only.

              • PROGRAMMING EXERCISE 1-2

                • A typical conversion should write the message 3 hours is equal to 180 minutes.

            3. Consider three numbers a, b, and c.

              • Write a program that will compute and display their sum, difference, product, quotients (a/ b/ c) and the sum of their squares.

              • PROGRAMMING EXERCISE 1-3

            4. A supermarket sells bags of mixed candies.

              • Four types of candies are offered.

                • Candy a costs Php. 35.00/kg;

                • Candy B cost Php. 45.00/ kg;

                • Candy C cost Php. 56.00/kg;

                • Candy D cost Php. 57.50 kg.

              • Write a program that will calculate and print the amount of bag of candies in terms of the weight of each type of candy as