structured statically typed imperative wide-spectrum object-oriented high-level computer programming language extended from Pascal and other languages.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Control Structures Ranga Rodrigo. Control Structures in Brief C++ or JavaEiffel if-elseif-elseif-else-end caseinspect for, while, do-whilefrom-until-loop-end.
Modules Program is built out of components. Each component defines a set of logically related entities (strong internal coupling) A component has a public.
ICE1341 Programming Languages Spring 2005 Lecture #13 Lecture #13 In-Young Ko iko.AT. icu.ac.kr iko.AT. icu.ac.kr Information and Communications University.
Air Force Institute of Technology Electrical and Computer Engineering
Programming Languages and Paradigms
Statement-Level Control Structures
Slide: 1 Copyright © AdaCore Arrays Presented Quentin Ochem university.adacore.com.
Expressions and Statements. 2 Contents Side effects: expressions and statements Expression notations Expression evaluation orders Conditional statements.
PL/SQL.
Chapter 10 Introduction to Arrays
Introduction to C Programming
 2000 Prentice Hall, Inc. All rights reserved. Chapter 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line.
Abstract Data Types Data abstraction, or abstract data types, is a programming methodology where one defines not only the data structure to be used, but.
COEN Expressions and Assignment
True or false A variable of type char can hold the value 301. ( F )
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
Program Design and Development
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
1) Introduction to higher level types 2) Arrays and their declaration 3) Assigning values to array elements 4) Operations on arrays 5) Ada array attributes.
Introduction to Programming Prof. Rommel Anthony Palomino Department of Computer Science and Information Technology Spring 2011.
Ada is a structured, statically typed, imperative, wide- spectrum, and object-oriented high-level computer programming language, extended from Pascal.
Pascal Course Spring Introduction Designed: 1968/9 by Niklaus Wirth Published: 1970 Imperative, structural, procedural Static and strong.
Ryan Chu. Arithmetic Expressions Arithmetic expressions consist of operators, operands, parentheses, and function calls. The purpose is to specify an.
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
Lecture Set 5 Control Structures Part D - Repetition with Loops.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
Slide: 1 Copyright © AdaCore Basic Types Presented by Quentin Ochem university.adacore.com.
Instructor - C. BoyleFall Semester
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
UniMAP Sem1-07/08EKT120: Computer Programming1 Week2.
Slide: 1 Copyright © AdaCore Subprograms Presented by Quentin Ochem university.adacore.com.
1Computer Sciences Department Princess Nourah bint Abdulrahman University.
Fall 2004EE 3563 Digital Systems Design EE 3563 VHDL – Basic Language Elements  Identifiers: –basic identifier: composed of a sequence of one or more.
© ABB University - 1 Revision C E x t e n d e d A u t o m a t i o n S y s t e m x A Chapter 11 Structured Text Course T314.
C++ Lecture 1 Friday, 4 July History of C++ l Built on top of C l C was developed in early 70s from B and BCPL l Object oriented programming paradigm.
Copyright Curt Hill Variables What are they? Why do we need them?
RUBY by Ryan Chase.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
CSC 143A 1 CSC 143 Introduction to C++ [Appendix A]
BASIC VHDL LANGUAGE ELEMENTS Digital Design for Instrumentation with VHDL 1.
Variables reference, coding, visibility. Rules for making names  permitted character set  maximum length, significant length  case sensitivity  special.
MT311 Java Application Development and Programming Languages Li Tak Sing ( 李德成 )
Stephen Davis Ada Object-Oriented Programming. Overview Ada 83 is not considered a true “object-oriented” programming language. Although Ada 83 did support.
Chapter 3 The General Structure of Ada Programs. General Form of an Ada Program With package1; With package2;... With packagen; Procedure pname IS - -
 Variables can store data of different types, and different data types can do different things.  PHP supports the following data types:  String  Integer.
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
 2007 Pearson Education, Inc. All rights reserved. A Simple C Program 1 /* ************************************************* *** Program: hello_world.
Data Handling in Algorithms. Activity 1 Starter Task: Quickly complete the sheet 5mins!
Names, Scope, and Bindings Programming Languages and Paradigms.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
UNIMAP Sem2-07/08EKT120: Computer Programming1 Week 2 – Introduction to Programming.
 2003 Prentice Hall, Inc. All rights reserved Basics of a Typical C++ Environment C++ systems –Program-development environment –Language –C++
Dr. M. Al-Mulhem Introduction 1 Chapter 6 Type Systems.
1 Lecture 2 - Introduction to C Programming Outline 2.1Introduction 2.2A Simple C Program: Printing a Line of Text 2.3Another Simple C Program: Adding.
Basic concepts of C++ Presented by Prof. Satyajit De
Chapter 1.2 Introduction to C++ Programming
Definition of the Programming Language CPRL
Chapter 1.2 Introduction to C++ Programming
Chapter 1.2 Introduction to C++ Programming
Chapter 1.2 Introduction to C++ Programming
Type Checking, and Scopes
Yanal Alahmad Java Workshop Yanal Alahmad
Chapter 8: Control Structures
Character Set The character set of C represents alphabet, digit or any symbol used to represent information. Types Character Set Uppercase Alphabets A,
Basics of ‘C’.
Chapter 2 Programming Basics.
Fundamental Programming
COMPUTING.
Presentation transcript:

structured statically typed imperative wide-spectrum object-oriented high-level computer programming language extended from Pascal and other languages the current version (known as Ada 2005) is defined by joint ISO/ANSI standard (ISO-8652:1995)

Notable features of Ada strong typing modularity mechanisms (packages) run-time checking parallel processing(tasks) exception handling Generics Ada 95 added support for object-oriented programming, including dynamic dispatch.

Output:Hello World

Selection if statement *Only if statement if Count = 3 then --If 3 print Put(“number is three"); New_Line; end if; *Nested if statement and else & else if statement if Count = 3 then Put("Count is 3"); New_Line; elsif Count = 5 then Put("Count is 5"); New_Line; else if Count = 4 then Put("Count is 4"); New_Line; else Put("Count is not 3 or 4"); New_Line; end if;

Repetition Statement *while statement while Count > 0 loop --loop while greater than 0 -- Repeated statements end loop; *for Statement for Count in loop --count declared here Put( Integer'Image( Count ) ); end loop;

Continue repetition *in reverse key word in for for Count in reverse loop Put( Integer'Image( Count ) ); end loop; *loop statement(for break in loop) loop Put( Count ); exit when Count = Count To; --Exit loop when... Count := Count + 1; end loop;

Variable names end comments *A variable name must start with a letter and can then be followed by any number of letters and digits and the underscore character. However, two underscore characters cannot occur next to each other and an underscore character must not start or finish a variable name. *comment with two – characters.Example; -- This program writes the message -- "Hello World" to a users terminal

Multiple selection case Ch := 'a'; --ch character variable case Ch is when '0' | '1' | '2' | '3' | '4' |'5' | '6' | '7' | '8' | '9' => Put("Character is a digit"); when 'A'.. 'Z' => Put("Character is upper case English letter"); when 'a'.. 'z' => Put("Character is lower case English letter"); when others => Put("Not an English letter or digit"); end case;

Input and output Put(variable name | string) print smth on screen.it is a function in Standart Ada.Text_Io. Get(variable name) read data from standart input and assign data to variable which is parameter of get functions. Like “put” function in Standart Ada.Text_Io

types *You can decleare new type in ada like this; type Distance is range _000; *ada allow type conversion between compatible type. variable name1:= variable type(con. Variable name) * constant declerations variable name: constant variable type:=value Type safety in ada(errors in a program can be detected at compile-time) type Miles is digits 8 range _000.0; type Kilometres is digits 8 range _000.0;

Continue type *subtype in ada type Speed_Mph is range _000; subtype Train_Speed is Speed_Mph range ; *enumerations type Colour is (Red,B Using enumerations... Car_Colour : Colour; begin Car_Colour := Blue; case Car_Colour is when Red => Put("A red car"); New_Line; when Blue => Put("A blue car"); New_Line; when Green => Put("A green car"); New_Line; end case; …..

operators *many operators same in c++.Not same operators and new operators “/=“  not equal operator “**”  Exponentiation operator(a**4) “mod”  Modulus “rem”  Remainder “abs”  Returns the absolute value “not”  not operator “in”  is a member of (not in;is not member) Ch in 'A'.. 'Z‘ “:=“  assigment operator “=“  equal operator “and,or,xor”  bitwise operators

Functions in ada call function in procedure or function Put( Float( M_To_K_Fun( No_Miles ) ), Aft=>2, Exp=>0 ); Note:Aft parameters mean that two precision print and no miles variable in Mile type

Procedures in ada

Function and prodecure

Continue Function and prodecure *diffirent number parameter can sent function function Max2( A,B:in Integer ) return Integer is *Default parameters procedure Answer_Is( N:in Integer;Message:in Boolean := True ) is function call like this Answer_Is( 27 ); Answer_Is( 27, True ); -- By position Answer_Is( 27, Message => False ); -- By name

Packages as classes

Clauses with and use l with Ada.Text_Io; Make available to the unit all the public components of the package. However, when components of the package are used in a program they must be prefixed with the package name. l use Ada.Text_Io; Permit public components of the package to be used without having to prefix their name with that of the package name.

The record structure

Nested record structures

Arrays

Attributes of an array

Multidimensional arrays

Initializing an array

Continue arrays String type is a predefined type. type String is array ( Positive range <> ) of Character;. Unconstrained arrays type Numbers_Array is array ( Positive range <> ) of Integer; Computers_In_In_Room :Numbers_Array( ) := (2,2,2,3,2,1,3);. Slices of an array Computers_In_Rooms( ).example; Put("Computers in rooms 517, 518 and 519 is: " ); Put( Sum( Computers_In_In_Room( ) ) ); New_Line;

Inheritance

Header of base/Super class

Header of derived/Sub class

Visibility rules (Normal inheritance)

Define Abstract class

Defining new operators

Overloaded operators for bounded string class

Exceptions

Exception continue

Generics

Generic stack class header

Inheriting from a generic class