Академический Документы
Профессиональный Документы
Культура Документы
objective
Understand basic data types Understand variables Statement Understand value assignment How to execute a program
Compilation interpretation
Is an internal code used by a computer to keep track of data it process. Most programming languages and database systems require the programmer to declare a data type for any data object. Note: data types normally differ from one programming language to another.
Integer : In more common parlance, whole number; a number that has no fractional part.
floating-point : A number with a decimal point. For example, 3 is an integer, but 3.5 is a floating-point number.
Note: Every programming technology support a set of these basic data types!
@2011 AITI-KACE All Rights Reserved - Fundamentals of Programming
Variable
Properties
Naming
be mindful of keywords and special character to use number of characters for most compiled programming languages
Length
Data type
Statement
Types of statements
instructional statement comment in a particular programming language adding of libraries termination of statement syntax
HTML : <!-- comment --> VB Java : /* : ' comment */
@2011 AITI-KACE All Rights Reserved - Fundamentals of Programming
Properties
Assignment statement
Example 1:
Once 18 has been assigned to age, unless another value is assigned to age in subsequent statements whenever age will be called 18 will be used.
Example 2:
double salary = 800.50; salary = 950.67; Question: What is the values now assigned to salary?
The source code must be compiled first with a compiler The resulting code is then executed Examples:
Modularity
The modularity is a concept use in software design to break down a complex problem into smaller units normally called modules.
Characteristics
each module has a name module name must be mnemonic each module accomplishes a task can be reuse can accept inputs in the form of arguments
Note: Other names used in place of modules are method and function
@2011 AITI-KACE All Rights Reserved - Fundamentals of Programming
10
Example 1 - Modularity
Determining an employee's pay based on hours worked and pay rate while using some company standard values for overtime.
Employee_Pay M1.[Get_Employee_Pay_Values] M2.[Calculate_Net_Pay] DISPLAY netPay END M1.Get_Employee_Pay_Values Get_Hours_Worked Get_Rate_of_Pay RETURN M2. Calculate_Net_Pay M2.1[Calculate_Gross_Pay] M2.2[Calculate_Total_Deductions] netPay = grossPay - deductions RETURN M2.1 Calculate_Gross_Pay M2.1.1[Calculate Regular Pay] M2.1.2[Calculate Overtime Pay] grossPay = regularPay + overtimePay RETURN
11
module, function or method variable(s) declared within a module is limited only to the unit.
Is called global variable Any module can used it Note: any module can change its value.
@2011 AITI-KACE All Rights Reserved - Fundamentals of Programming
12