Basic Computer Programming Using VB6

Embed Size (px)

Citation preview

  • 7/31/2019 Basic Computer Programming Using VB6

    1/54

  • 7/31/2019 Basic Computer Programming Using VB6

    2/54

  • 7/31/2019 Basic Computer Programming Using VB6

    3/54

  • 7/31/2019 Basic Computer Programming Using VB6

    4/54

    7. Draw the flowcharts.

    8. Follow the guidelines in creating a

    flowchart.9. Develop critical, logical and analytical

    thinking in preparing for program writing.

  • 7/31/2019 Basic Computer Programming Using VB6

    5/54

    Programming Is the process of giving instruction toa computer

    Programs Are the instructions given to the

    computer to arrive at a certain result.

  • 7/31/2019 Basic Computer Programming Using VB6

    6/54

    Logic formulations and problem-solving arethe fundamentals of programming. Itrequires an intricate process of critical andanalytical thinking combined with precision

    and keenness to details. The planning stageis very important because it serves as thebackbone of any program.

    NOTE:

  • 7/31/2019 Basic Computer Programming Using VB6

    7/54

    A logical procedure or set of stepsto be followed to arrive at asolution to a problem.

    An algorithm is the breakingdown of a problem into simplesteps in order to find the rightanswer.

  • 7/31/2019 Basic Computer Programming Using VB6

    8/54

    Recipe in a cookbook a complicated dish isbroken down into simple cookinginstructions.

    Choreography of a dance a difficult dance isbroken down into a succession of basic steps

    Word problem in Math a complex problemin Math is broken down into parts to arrive ata solution.

  • 7/31/2019 Basic Computer Programming Using VB6

    9/54

    An algorithm in Englishstatements in an outline form.

    This is used to conceptualizethe flow of the program beforeencoding it in a programming

    language.

  • 7/31/2019 Basic Computer Programming Using VB6

    10/54

    Pseudocode for Making Soap Step 1: Prepare your workspace

    Step 2: Cut and weight the soap base.

    Step 3: Melt the soap base.

    Step 4: Add the fragrance or essentials oil Step 5: Add color to the melted soap

    Step 6: Stir the melted soap

    Step 7: Pour the soap into the mold

    Step 8: Unmold the soap

  • 7/31/2019 Basic Computer Programming Using VB6

    11/54

    Pseudocode for Taking a special quiz Step 1: Talk to the teacher. Tell her your concern

    Step 2: Give her the excuse letter

    Step 3: Ask politely for a schedule to have a quiz

    Step 4: If you are free on the given schedule, tellher you will be there to take the quiz.

    Step 5: If the schedule will be conflicting to anotherspecial quiz ask for another time and date until the

    schedule is finalized. Step 6: Go on the scheduled date and time.

  • 7/31/2019 Basic Computer Programming Using VB6

    12/54

    The graphical representation of analgorithm. Flowchart is the pictorialdescription of sequenced activities

    and logic to be performed by thecomputer for carrying out dataprocessing. It uses special symbols

    which represent a specific function.

  • 7/31/2019 Basic Computer Programming Using VB6

    13/54

    Flowcharts are used by programmers beforethe actual start of any programming activity.

    Flowchart is otherwise known as

    Flowcharts are used by programmers beforethe actual start of any programming activity.

    Flowchart is otherwise known as

    Flowchart is the so called BLUE PRINT of aprogram.

  • 7/31/2019 Basic Computer Programming Using VB6

    14/54

    TERMINAL- Represents thebeginning and the end of the

    program. It contains the wordsBegin or Start and End or

    Stop.

    PROCESS OR ACTION -Representsa step or an instruction such ascomparison or arithmetic operations.

    Ex: Gather all materials in a box;

    Add 5 and 7

    INPUT OR OUTPUT - Represents thestep wherein information such asletters and numbers are entered bythe user or produced by the process.

    Ex: Input 3 numbers; Get A, B, C;

    Print A

  • 7/31/2019 Basic Computer Programming Using VB6

    15/54

    ARROW OR FLOW DIRECTION

    INDICATOR Indicates the flowof direction or the next activity.

    DECISION Denotes a decision tobe made. It involves 2 courses of

    action that is answered by eitheryes/true or no/false wherein one

    has to chosen. The symbolrepresents the if..then{, and the for

    .. Next statements

    PREPARATION

    Represents theprocess that will change the directionof initialization of any value or theexecution of a variable.

  • 7/31/2019 Basic Computer Programming Using VB6

    16/54

    PREDEFINED PROCESS OR

    SUBROUTINE Indicates asubmodule or subflowchartembedded within a larger

    process. It can be described in adetail in a separate flowchart.

    ON-PAGE CONNECTORS

    Indicates that the process iscontinued where the matching on

    page connector is placed (either onthe same page or at a different page)

  • 7/31/2019 Basic Computer Programming Using VB6

    17/54

  • 7/31/2019 Basic Computer Programming Using VB6

    18/54

    BEGIN

    Exercise daily

    Give time, effortand commitment

    ENDFit and

    healthy body

    Sleep 8 hours a day

    Have a balanced diet

    Take vitamins

  • 7/31/2019 Basic Computer Programming Using VB6

    19/54

    No

    Yes

    BEGIN

    Correctusername

    andpassword

    END

    Type Internetusername and

    password

    Access the

    Internet

  • 7/31/2019 Basic Computer Programming Using VB6

    20/54

  • 7/31/2019 Basic Computer Programming Using VB6

    21/54

    1. The flow of the program is easilyunderstood.

    2. It determines the validity of the processesinvolved in the program.

    3. Debugging or correcting of errors becomes lesscomplicated.

    4. It produces effective program documentation.

  • 7/31/2019 Basic Computer Programming Using VB6

    22/54

    1. Determine the following:

    Data to be entered

    Information to be produced

    The way the data will be entered The point when data will be given

    The point when information will be produced

    1. There should be only be one start/begin and

    stop/end processes.2. Concentrate on the logic of the program.

    3. Choose only the important steps. No need torepresent all the steps in the flowchart.

  • 7/31/2019 Basic Computer Programming Using VB6

    23/54

    2 classifications of programming language.These pertains to the ways on how theprogram are written.

    resembles humanlanguage and corresponds to severalmachine language instructions

    or machine

    language, describes exactly the proceduresto be carried out by the computers centralprocessing unit

  • 7/31/2019 Basic Computer Programming Using VB6

    24/54

    High level Programming language includes :

    1. Visual Basic

    2. Java3. Visual C++

    4. BASIC

    5. Pascal

    6. COBOL

    7. FORTRAN

  • 7/31/2019 Basic Computer Programming Using VB6

    25/54

  • 7/31/2019 Basic Computer Programming Using VB6

    26/54

    Okay now, start getting busy by doing yourfirst exercise for this module.

  • 7/31/2019 Basic Computer Programming Using VB6

    27/54

    Plant and produce carrots Charter change (with decision box)

    Get the area of a rectangle

    Input 2 numbers and print the largernumber

    Get the quotient of 2 numbers and print thequotient if it is greater than 5

    Compute and print for the average of 3numbers

  • 7/31/2019 Basic Computer Programming Using VB6

    28/54

  • 7/31/2019 Basic Computer Programming Using VB6

    29/54

  • 7/31/2019 Basic Computer Programming Using VB6

    30/54

    A program handles different data to beprocessed by the computer. These data areclassified into different types:

    Numeric data - whole

    numbers with decimal

    Alphanumeric Data

    numbers that cannot be used formathematical operations

  • 7/31/2019 Basic Computer Programming Using VB6

    31/54

    a single letter or a special character a combination of characters

    Date and time

    Logical Data

  • 7/31/2019 Basic Computer Programming Using VB6

    32/54

    A variables stores data, Itallocates a portion of the

    memory depending on thetype of data a variables holds.

  • 7/31/2019 Basic Computer Programming Using VB6

    33/54

    It must begin with a letter or an alphabetand may be followed by combinations ofalphanumeric characters.

    The name of the variables should beindicative of the value it holds.

    Avoid using confusing letters or numbers

    such as zero and the letter O. Use underscore in replacement of a space.

  • 7/31/2019 Basic Computer Programming Using VB6

    34/54

    Lessen the number of characters ofyour variable. The shorter thevariable, the better and more

    efficient the program will be In most cases, uppercase andlowercase letters are read differently

    A and a may hold different data

  • 7/31/2019 Basic Computer Programming Using VB6

    35/54

    Constants are values that do not changeduring the execution of the program.

    Examples: Pi = 3.1416

    X=100

  • 7/31/2019 Basic Computer Programming Using VB6

    36/54

    Classifications of Operators Arithmetic Operators

    Addition

    Subtraction

    Multiplication Division

    Exponentiation

    Modulus

    NegationEx: 5+(4*2/2) 3 =6

  • 7/31/2019 Basic Computer Programming Using VB6

    37/54

    Relational Operators Greater than >

    Less than =

    Less than or equal to

  • 7/31/2019 Basic Computer Programming Using VB6

    38/54

    Input 2 whole numbers. Compute and printthe sum of the 2 numbers

  • 7/31/2019 Basic Computer Programming Using VB6

    39/54

    When a problem involves the 3 Types ofoperators, the following order should befollowed.

    The hierarchy is as follows:

    1st Arithmetic operators

    2nd Comparison operators

    3rd logical operators

  • 7/31/2019 Basic Computer Programming Using VB6

    40/54

    The hierarchy is as follows:

    1st NOT

    2nd AND 3rd OR

    Ex:

    5*5+10/5 >40 AND 8

  • 7/31/2019 Basic Computer Programming Using VB6

    41/54

  • 7/31/2019 Basic Computer Programming Using VB6

    42/54

    Input 5 numbers. Find the sum, differenceand product of the number. Print the answer

    Convert a number in degree Fahrenheit (0F) toCelsius (C)

    A rectangular table has a length of 60.5

    inches and a width of 20.5 inches. Find andprint the perimeter.

  • 7/31/2019 Basic Computer Programming Using VB6

    43/54

    Conditional statements is one of the vitalcomponents in programming. It enables aprogram to respond in a different mannerevery time a program is executed

    depending on the data entered.

    The commonly used conditional statementsare:

    If statement If ...then.. Else statements

    Select case statements

  • 7/31/2019 Basic Computer Programming Using VB6

    44/54

    This is used to evaluate a condition or checka value as true or false. If the condition isnot met, the succeeding statements or set ofstatements will executed.

    SyntaxIf condition

    Statement

    End if

  • 7/31/2019 Basic Computer Programming Using VB6

    45/54

    Input a color. If the color is blue, display themessage The color is blue.

    Algorithm:

    String colorBegin

    Input color

    If color= blue

    Print The color is blue

    End If

    End

  • 7/31/2019 Basic Computer Programming Using VB6

    46/54

    Input a score. If the is 100, display themessage Excellent

  • 7/31/2019 Basic Computer Programming Using VB6

    47/54

    This is used to evaluate a condition or checka value as true or false. If the condition isnot met, the statement or set of statementsafter will be executed

    Syntax: If condition then

    Statement 1

    Else

    Statement 2End if

  • 7/31/2019 Basic Computer Programming Using VB6

    48/54

    If condition thenStatement(s)

    Else if condition 1 then

    Statement(s)

    Else if condition 2 then

    Statement(s)

    Else

    Statement(s)

  • 7/31/2019 Basic Computer Programming Using VB6

    49/54

    Input a grade. If the grade is greater than orequal to 75, display the message You passedthe subject, otherwise display Study hard

    Input 2 prices and get the total. If the total is

    more than P500, get 5% of the total, if thetotal is more than P500 but less than or equalto P1000, get 10% of the total, but if the totalis greater than P1000, get 15% of the total.

    Display the discounted price.

  • 7/31/2019 Basic Computer Programming Using VB6

    50/54

    The case statement is similar to the use ofthe If... Then .. Else statement. It is usedwhen a variable is compared to differentvalues or expressions.

    SyntaxSelect Case test expression

    Case expressionlist1

    Statement Block1Case expressionlist2

    Statement Block2

    End Select

  • 7/31/2019 Basic Computer Programming Using VB6

    51/54

    Conduct Grade Equivalent1 Excellent

    2 Very Good

    3 Good

    4 Satisfactory

    5 Needs Improvement

    Input a conduct grade and display the

    equivalent rating

  • 7/31/2019 Basic Computer Programming Using VB6

    52/54

  • 7/31/2019 Basic Computer Programming Using VB6

    53/54

    Okay now, start getting busy by doing yourfirst exercise for this module.

  • 7/31/2019 Basic Computer Programming Using VB6

    54/54