Docsity

very good computer s, Notes de Comptabilité et Finance des Entreprises

Toggle sidebar
bg1
Life cycle of programming
Parts of analysing
● Abstraction - removes any unnecessary parts and keeping all relevant ideas which
simplifies the problem
● Decomposition - breaking down the system into simpler smaller parts so that it can be
easily understood of process input output storage
● Identification of problems - specifying the processes, input, output and storage
Design
Details of solution
Can be represented as
● structure diagrams
● flowcharts
● pseudocode
Coding
Program is being developed
Testing
Program is being tested for errors
Type of variables
Global
- scope is of entire program
- can be changed anywhere in the program
Local
- scope is of part of the entire program
- can only be change within that part and cannot be changed elsewhere (like in a
subroutine)
Constant and Variables
Both are used for data storage
Constants are not change and always fixed during execution of a program
Variables can be changed during execution of program
Subroutine
Functions and procedures
Defining - setting up
Call - to use the subroutine and execute
Functions - always returns a value back to the main program
Procedures - does not return a value
Parameters - are passed from the main program to the function/procedure
Reason for subroutines:
● Makes program shorter
● Program development is faster as they can be reused
● Able to write many statements under single identifier
● Has meaningful identifiers
Reason for parameters:
● Can be used in the subroutines
pf3
pf4
pf5

Aperçu partiel du texte

Télécharge very good computer s et plus Notes au format PDF de Comptabilité et Finance des Entreprises sur Docsity uniquement!

Life cycle of programming Parts of analysing ● Abstraction - removes any unnecessary parts and keeping all relevant ideas which simplifies the problem ● Decomposition - breaking down the system into simpler smaller parts so that it can be easily understood of process input output storage ● Identification of problems - specifying the processes, input, output and storage Design Details of solution Can be represented as ● structure diagrams ● flowcharts ● pseudocode Coding Program is being developed Testing Program is being tested for errors

Type of variables Global

  • scope is of entire program
  • can be changed anywhere in the program Local
  • scope is of part of the entire program
  • can only be change within that part and cannot be changed elsewhere (like in a subroutine) Constant and Variables Both are used for data storage Constants are not change and always fixed during execution of a program Variables can be changed during execution of program Subroutine Functions and procedures Defining - setting up Call - to use the subroutine and execute Functions - always returns a value back to the main program Procedures - does not return a value Parameters - are passed from the main program to the function/procedure Reason for subroutines: ● Makes program shorter ● Program development is faster as they can be reused ● Able to write many statements under single identifier ● Has meaningful identifiers Reason for parameters: ● Can be used in the subroutines

● allows subroutine to be reused for different data

Files Reasons for storing data in a file: Stores permanently Can be reused at a later time Can be transferred and use on another computer

Test Data ● Normal - Data is accepted ● Abnormal - Data is rejected ● Extreme - Data that is the maximum or minimum value in the range that can be accepted ● Boundary - Data that includes the maximum and minimum value of data can be accepted or rejected. It is just like extreme but it includes the data that is rejected Extreme and boundary are used to test the limits of acceptable data entry

Data types * *(Dont confuse with TEST data types they are different) In programs: ● Integers - whole numbers ● Real - contains fractional part ● String - combination of letters numbers and special characters ● Boolean - only two values of true and false ● Char - single letter

In databases: ● Integer ● Real ● Text - same as string ● Boolean ● Char ● Date/Time

How to make programs better ● Add meaningful identifiers so programmers can understand their purpose ● Add comments so programmers know how the code works ● Use subroutines

Flowcharts

● COUNT(Field) - counts number of records that fits the criteria

Validation Checks ● Range checks - Accepts value that is between an upper and lower value ● Length checks - Accepts data if number of characters is within accepted range ● Type check - accepts data if it is of correct data type ● Presence check - accepts data if it has been entered and rejects if left blank ● Format check - characters has to be entered in a specific pattern Verification Checks ● Visual Check - Manual check to see if data matches as seen on form ● Double Entry - Data is entered twice and then compared and if it matches it is accepted

Pseudocode DECLARE variable: DATATYPE DECLARE list: ARRAY[1:5]OF DATATYPE // for array with 5 elements

PROCEDURE {identifier} (parameters:data type, parameter2:data type) statements ENDPROCEDURE

FUNCTION {identifier} (parameters:data type, parameter2:data type) RETURNS {data type} statements ENDFUNCTION LENGTH (finding number of characters in a string) SUBSTRING (taking out a part of a string)- example SUBSTRING (hello,3,3) would be llo UCASE (convert all letters to uppercase a -> A) LCASE (Convert all letters to lowercase A -> a) MOD (Remainder after division) DIV (divide a value (by an integer only)) ROUND (Returns a value rounded to a certain number of decimal places) RANDOM (returns a random number)

// comment

OPEN (filename) FOR READ/WRITE - gives access to a file to read/write READ (filename),(variable) - retrieves data from the file WRITE (filename),(variable) - stores data in the file CLOSE (filename)

NEXT Index Bubble sort Last <- LENGTH(Array) REPEAT Swap <- False FOR Index <- 1 TO Last - IF Array[Index]>Array[Index + 1]THEN Temp<- Array[Index] Array[Index]<-Array[Index+1] Array[Index+1]<-Temp Swap <- True ENDIF NEXT Index Last<- Last - UNTIL NOT Swap OR Last=

Good luck for tmrw gng :p