Object oriented programming. Course Objectives. On completion of the class, a student should be able: Object Oriented Paradigm

Size: px
Start display at page:

Download "Object oriented programming. Course Objectives. On completion of the class, a student should be able: Object Oriented Paradigm"

Transcription

1 Object oriented programming Course Objectives Object Oriented Paradigm C/C++ Programming Language On completion of the class, a student should be able: to prepare object-oriented design for small/medium scale problems to demonstrate the differences between traditional imperative design and object-oriented design to explain class structures as fundamental, modular building blocks to understand the role of inheritance, polymorphism, dynamic binding and generic structures in building reusable code to write small/medium scale C++ programs with simple graphical user interface to use classes written by other programmers when constructing their systems to understand and to use fundamental data structures: collections, sets, dictionaries, lists, stacks, queues, trees, graphs.

2 Bibliography 1. A.V. Aho, J.E. Hopcroft, J.D. Ullman, Data Structures and Algorithms, Addisson-Wessley Publ., Massachusetts, R. Andonie, I. Garbacea, Algoritmi fundamentali. O perspectiva C++, Editura Libris, 3. Alexandrescu, Programarea moderna in C++. Programare generica si modele de proiectare aplicate, Editura Teora, M. Frentiu, B. Parv, Elaborarea programelor. Metode si tehnici moderne, Ed. Promedia, Cluj-Napoca, E. Horowitz, S. Sahni, D. Mehta, Fundamentals of Data Structures in C++, Computer Science Press, Oxford, K.A. Lambert, D.W. Nance, T.L. Naps, Introduction to Computer Science with C++, West Publishing Co., New-York, L. Negrescu, Limbajul C++, Ed. Albastra,Cluj-Napoca Dan Roman, Ingineria programarii obiectuale, Editura Albastra, Cluj_Napoca, B. Stroustup, The C++ Programming Language, Addison Wesley, Bruce Eckel, Thinking in C++, Mats Henricson, Erik Nyquist, Industrial Strength C++, Prentice Hall PTR, 1995 Activities: Lecture: 2h/week Seminar: 1h/week Lab:2h/week Grade: Lab grade (30%) - (70% lab + 30% partial) Practical Exam (30%) Written exam (40%) Seminar activity 0 0.5p Minimum grade >= 5 at Practical, Written and Lab grade Contact: Mail: istvanc@cs.ubbcluj.ro Course Web address:

3 Content Lecture 1 - C Programming language data types, variables, statements Lecture 2 - Procedural programming in C functions,modules Lecture 3 - Memory management Pointers and references Lecture 4 - C++ programming language classes, objects, templates Lecture 5 - Inheritance, polymorphism derived classes, abstract classes Lecture 6 - Input/output stream, exceptions Lecture 7 - Graphical user interface Qt Toolkit Lecture 8 - GUI user interaction signals and slots Lecture 9 - GUI components Lecture 10 - Model-view-controller Lecture 11 - Standard Template Library containers, iterators Lecture 12 - Design patterns Lecture 13 - Memory management smart pointers Lecture 14 - Recap

4 Lecture 1 Object-oriented programming Introduction - OOP C Programming language syntax data types, variables, statements functions

5 Programming evolution Machine code programs in binary code, executed directly by the processor Assembly languages still low level programming, replaced machine code functions with mnemonics and memory addresses with symbolic labels Procedural programming decompose programs into procedures/functions Modular Programming decompose programs into modules Object Oriented Programming decompose program into a set of objects objects interact with each other to form a system

6 Object Oriented Paradigm Provide flexible and powerful abstraction Allow programmers to think in terms of the structure of the problem rather than in terms of the structure of the computer. Decompose the problem into a set of objects Objects interact with each other to solve the problem create new type of objects to model elements from the problem space An object is an entity that: has a local state able perform some operation (behavior) It may be viewed as a combination of: data (attributes) procedural elements (methods) Object Oriented Programming is a method of implementation where: objects are fundamental building blocks each object is an instance of some type (class) classes are related to each others by inheritance Fundamental concepts and properties Concepts: object class method (message) Properties: encapsulation inheritance polymorphism

7 C/C++ Programming Language Why C/C++: widely used, both in industry and in education is a high level programming language hybrid language, implements all the concepts needed for object oriented programming (C++) many programming languages are based on C/C++ (Java, C#). Knowing C++ makes learning other programming languages easier Advantages: Conciseness: allow us to express common sequences of commands more concisely. Performance: program written in c++ usually run faster than programs written in other languages Maintainability: modifying code is easier when it entails just a few text edits,instead of rearranging hundreds of processor instructions. Portability: can be used to write programs for nearly any processor Productivity: The goal of C++ is improved productivity (over C).

8 Compiled Languages. The compilation Process A program goes from text files (or source files) to processor instructions as follows: Source file - text file, contain the program in a programming language - compiler, parse the source files and create object files Object File - intermediate files that represent an incomplete copy of the program - linker, combine multiple object files and create the program that can be executed Executable - operating system, load the executable file into the memory and execute the program Program in memory In C/C++, all these steps are performed ahead of time, before you start running a program. In some languages, they are done during the execution process, which takes time. This is one of the reasons C/C++ code runs far faster than code in many more recent languages. Python (Interpreted) vs C/C++ (compiled)

9 Integrated Development Environment for C/C++ Compiler MinGW - - Minimalist GNU for Windows, a native Windows port of the GNU Compiler Collection (GCC) MinSYS - is a collection of GNU utilities such as bash, make, gawk and grep Eclipse IDE Eclipse CDC provides a fully functional C and C++ Integrated Development Environment based on the Eclipse platform. C Project Hello World sample application

10 Lexical elements C/C++ is case sensitive (a <> A) Identifier: Sequence of letters and digits, start with a letter or _ (underline). Names of things that are not built into the language Ex. i, myfunction, rez, Keywords (reserved words): Identifier with a special purpose Words with special meaning to the compiler int, bool, for, Literals: Basic constant values whose value is specified directly in the source code Ex. Hello, 72, 4.6, c Operators: Mathematical or logical operations +,-, << Separators: Punctuation defining the structure of a program ; {, ( ) Whitespace: Spaces of various sorts; ignored by the compiler space, tab, new line Comments: ignored by the compiler // this is a single line comment /* This is a * multiline comment */

11 Data types A type is a domain of values and a set of operations defined on these values. Built in data types: Name Description Size Range char Character or small integer. 1byte signed: -128 to 127 unsigned: 0 to 255 int Integer. 4bytes signed: to unsigned: 0 to float Floating point number. 4bytes +/- 3.4e +/- 38 (~7 digits) double Double precision floating point number. 8bytes +/- 1.7e +/- 308 (~15 digits) long double Long double precision floating point number. 8bytes +/- 1.7e +/- 308 (~15 digits) short int (short) long int (long) Short Integer. 2bytes signed: to unsigned: 0 to Long integer. 4bytes signed: to unsigned: 0 to operations: +, -, *, /, % relations: <, >, <=, >=, ==,!= short/long can be used to change the domain of the type signed/unsigned can be used to change how the value is interpreted (the sign bit) operations can be performed only on compatible types. Ex. Can t take the remainder of an integer and a floating-point number

12 Built in Data types in C/C++ void test_integers() { // ASCII "char" char c = 'a'; // at least 1 byte, signed assert(c == 'a'); c++; assert(c == 'b' && c == 98); //'b' synonym for the int value 98 c = 255; // in case of 1 byte assert(c == -1); // so, it's true // Small integer short s = 1; // at least 2 bytes, signed // Default integer int i = 2; // at least 2 bytes (typically 4), signed // Large integer long l = 3; // at least 4 bytes, signed assert(s + i == l); void test_floating_points() { float f = 1.0; // single precision, typically 4 bytes double d = 1.0; // double precision, typically 8 bytes assert(f == d); float f2 = 1/3.0; // division assert(f2!=0.333); float f3 = 1/3; //! perform integer division assert(f3==0);

13 Arrays If T is an arbitrary basic type: T[n] - is an array of length n with elements of type t indexes are from 0 to n-1 indexing operator: [ ] compare 2 arrays by comparing the elements multidimensional arrays: t[n][m] #include <stdio.h> int main() { int a[5]; // create an array with 5 elements a[0] = 1; //index start from 0 a[1] = 2; printf("a[0]=%d \n", a[0]); printf("a[1]=%d \n", a[1]); //!!! a[2] uninitialised printf("a[2]=%d \n", a[2]); int b[] = { 1, 2, 3, 5, 7 ; printf("b[0]=%d \n", b[0]); b[0] = 10; printf("b[0]=%d \n", b[0]); return 0;

14 C String Represented as char arrays, the last character is '\0' (mark the end of the string) Handled as any ordinary array C include a standard library for string manipulation (<string.h>) strlen - Return the number of chars in a C string strcpy - Copy the characters from the source string to the destination string. -Obs. the assignment operator will not copy the string (or any array) strcmp - Compare two strings and return zero:a==b, negative:a<b, positive:a>b. - Obs. using ==,<,> operators on C strings (or any array) compare memory addresses strcat - Append the characters from the source string to the end of destination string Obs. None of these string routines allocate memory or check that the passed in memory is the right size. #include <stdio.h> #include <string.h> int main() { char name[100]; strcpy(name, "Popescu"); printf("name:%s l=%d", name, strlen(name)); char name2[100]; strcpy(name2, name); printf("name:%s l=%d", name2, strlen(name2)); while (getchar()!= 'e'){; return 0;

15 Record - composite type is a collection of items of different types. group various built-in data types into a structure. struct name{ type1 field1; type2 field2 //introduce a new type //called: struct car struct car{ int year; int nrkm; car c; c.year = 2010 c.nrkm = 30000; typedef - Introduce a shorthand name for a type #include <stdio.h> //introduce a new type called Car typedef struct { int year; int km; Car; int main() { Car car, car2; //initialise fields car.year = 2001; car.km = 20000; printf("car 1 fabricated:%d Km:%d \n", car.year, car.km); //!!! car2 fields are uninitialised printf("car 1 fabricated:%d Km:%d \n", car2.year, car2.km); return 0;

16 Variable declaration Introduce a name into the program and associate a type to the name. Memory is allocated according to the type of the variable. Variable is a named location in memory The type tell the compiler how much memory to reserve for it and what kinds of operations may be performed on it The value is undefined until the variable is initialized Can combine (recommended) the declaration with the initialization Use meaningful names for the variables Always initialize the variables with a meaningful value <type> <identifier> Ex. int i long rez int j=7 Constants numeric constants: 1, 12, 23.5 string constants: Hello World character: c

17 Rules and recommendations (Industrial Strength C++ Mats Henricson, Erik Nyquist) Names (variables, constants, types, functions...) If names are not chosen, written and administrated with care, then you will end up with a program that is hard to understand, read and maintain. Use meaningful names. Use English names for identifiers. Be consistent when naming functions, types, variables and constants Comments Specify every method using comments Inside a function/method: Comments are unfortunately hard to maintain, so with a few exceptions they should only explain what is not obvious from reading the program itself. Each file should contain a copyright comment. Each file should contain a comment with a short description of the file content. Each method should have specifications included in a comment Every file should declare a local constant string that identifies the file. Use // for comments. All comments should be written in English.

18 Pointing to data - Pointers - Pointers are designed for storing memory address - Can store the address of another variable, address of a memory location Declaration - same as declaring a normal variable except '*' in front of the variables identifier. Ex: int *a; long *a, char *a Operators - address of operator '&': - take the address of a variable - dereferencing operator '*' - get the value at the memory address pointed to #include <stdio.h> int main() { int a = 7; int *pa; printf("value of a:%d address of a:%p \n", a, &a); //assign the address of a to pa pa = &a; printf("value of pa:%d address of pa:%p \n", *pa, pa); //a and pa refers to the same memory location a = 10; printf("value of pa:%d address of pa:%p \n", *pa, pa); return 0;

19 Statements A statement is a unit of code that does something a basic building block of a program. An expression is a statement that has a value. Every statement is ended by: ; (except the compound statement) Empty statement: ; Compound statement: { //multiple statements here Assignment Assignment operator: = Assign a value to a variable (initialize or change the value of a variable)

20 Conditional: if, if-else and else if if (condition){ //statements executed only if the condition is true The condition is some expression whose value is being tested. If the condition resolves to a value of true, then the statements are executed before the program continues. Otherwise, the statements are ignored. If there is only one statement, the curly braces may be omitted. if (condition){ //statements executed if the condition is true else { //statements executed only if the condition is not true if (condition1){ //statements executed if the condition1 is true else if (condition2){ //statements executed only if condition1 is not true and the condition2 is true condition, condition1, condition2 - are expressions any expression has a numeric value a value equal with 0 is false, any other value is true

21 Conditional: switch-case switch(expression) { case constant1: statementa1 statementa2... break; case constant2: statementb1 statementb2... break;... default: statementz1 statementz2... The switch evaluates expression and, if expression is equal to constant1, then the statements beneath case constant 1: are executed until a break is encountered. If expression is not equal to constant1, then it is compared to constant2. If these are equal, then the statements beneath case constant 2: are executed until a break is encountered. If not, then the same process repeats for each of the constants, in turn. If none of the constants match, then the statements beneath default: are executed

22 Loops Loops execute certain statements while certain conditions are met. while and do-while while(condition) { statement1 statement2 As long as condition holds, the block of statements will be repeatedly executed. If there is only one statement, the curly braces may be omitted do { statement1 statement2 while(condition); The block of statements is executed and then, if the condition holds, the program returns to the top of the block. Curly braces are always required.

23 for loop for(initialization; condition; incrementation) { //body initialization - initialise one or more variables incrementation - executed after each iteration The for loop is designed to allow a counter variable that is initialized at the beginning of the loop and incremented (or decremented) on each iteration of the loop. As long as condition holds, the block of statements will be repeatedly executed. A for loop can be expressed as a while loop and vice-versa. for(initialization; condition; incrementation) { statement1 statement2 initialization while(condition) { statement1 statement2 incrementation

24 Instructions - loops #include <stdio.h> int main(int argc, char **argv) { //read 5 numbers int i=0; for (i=0;i<5;i++){ int nr = 0; printf("give a number[%d]:",i); scanf("%d",&nr); printf("number=%d\n",nr); //read numbers until user enters 0 int nr = 0; do{ printf("give a number (or 0 for exit):"); scanf("%d",&nr); printf("number=%d\n",nr); while(nr!=0); //divide number to 2 int number = 0; printf("give a number:"); scanf("%d",&number); int count = 0; while (number%2==0){ number = number / 2; count++; printf("result %d divided %d times",number,count); // wait until the user hit 'e' while (getchar()!='e'){; return 0;

25 Rules and recommendations (Industrial Strength C++ Mats Henricson, Erik Nyquist) Do not change a loop variable inside a for-loop block. Update loop variables close to where the loop-condition is specified. Use a for loop if the loop variable is updated on exit from the block AFTER the loop condition has been checked. Use a do-while loop if the loop will execute at least once and if the loop variable is updated BEFORE the condition is checked. Use a while loop if the loop variable is updated on entry to the block AFTER the loop condition has been checked. All flow control primitives (if, else, while, for, do, switch and case) should be followed by a block, even if it is empty. Statements following a case label should be terminated by a statement that exits the switchstatement. All switch statements should have a defaultclause. Use break and continue instead of goto.

26 Read/Write from/to console printf() - print to the console (standard output) / puts() #include <stdio.h> int main() { int nr = 5; float nrf = 3.14; char c = 's'; char str[] = "abc"; printf("%d %f %c %s", nr, nrf, c, str); return 0; A format specifier follows this prototype: %[flags][width][.precision][length]specifier specifier: d,s,p (decimal, string, pointer) scanf() - read from the command line / fgets() / gets() int main() { int nr; float f; printf("enter a decimal number:"); //read from the command line and store the value in nr scanf("%d", &nr); printf("the number is:%d \n", nr); printf("enter a float:"); if (scanf("%f", &f) == 0) { printf("error: Not a float:"); else { printf("the number is:%f", f); //wait until user enters 'e' while(getchar()!='e'); return 0; A format specifier for scanf follows this prototype: %[*][width][length]specifier Specifier: d, f, s (decimal, floating-point, string)

27 First calculator Problem statement A teacher needs a program for students who learn or use rational numbers. The program shall help students to make basic arithmetic operations. #include <stdio.h> int main() { int totalm = 0; int totaln = 1; int m; int n; while (1) { printf("enter m, then n to add\n"); scanf("%d", &m); scanf("%d", &n); totalm = totalm * n + m * totaln; totaln = totaln * n; printf("total: %d/%d\n", totalm, totaln); return 0; Using struct #include <stdio.h> typedef struct{ int m,n; Rational; int main() { Rational total= {0,1; int m;int n; while (1) { printf("enter m, then n to add\n"); scanf("%d", &m); scanf("%d", &n); total.m = total.m * n + m * total.n; total.n = total.n * n; printf("total: %d/%d\n", total.m, total.n); return 0;

28 Outline Introduction - OOP C Programming language syntax statements data types functions

Lecture 2 Notes: Flow of Control

Lecture 2 Notes: Flow of Control 6.096 Introduction to C++ January, 2011 Massachusetts Institute of Technology John Marrero Lecture 2 Notes: Flow of Control 1 Motivation Normally, a program executes statements from first to last. The

More information

C++ Programming Language

C++ Programming Language C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void 1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

More information

Syllabus for CS 134 Java Programming

Syllabus for CS 134 Java Programming - Java Programming Syllabus Page 1 Syllabus for CS 134 Java Programming Computer Science Course Catalog 2000-2001: This course is an introduction to objectoriented programming using the Java language.

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

Phys4051: C Lecture 2 & 3. Comment Statements. C Data Types. Functions (Review) Comment Statements Variables & Operators Branching Instructions

Phys4051: C Lecture 2 & 3. Comment Statements. C Data Types. Functions (Review) Comment Statements Variables & Operators Branching Instructions Phys4051: C Lecture 2 & 3 Functions (Review) Comment Statements Variables & Operators Branching Instructions Comment Statements! Method 1: /* */! Method 2: // /* Single Line */ //Single Line /* This comment

More information

1/20/2016 INTRODUCTION

1/20/2016 INTRODUCTION INTRODUCTION 1 Programming languages have common concepts that are seen in all languages This course will discuss and illustrate these common concepts: Syntax Names Types Semantics Memory Management We

More information

El Dorado Union High School District Educational Services

El Dorado Union High School District Educational Services El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.

More information

The programming language C. sws1 1

The programming language C. sws1 1 The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

More information

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive

More information

ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology)

ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology) ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology) Subject Description: This subject deals with discrete structures like set theory, mathematical

More information

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement? 1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

More information

Pemrograman Dasar. Basic Elements Of Java

Pemrograman Dasar. Basic Elements Of Java Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle

More information

Chapter 1. Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages

Chapter 1. Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages Chapter 1 CS-4337 Organization of Programming Languages Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705 Chapter 1 Topics Reasons for Studying Concepts of Programming

More information

Java (12 Weeks) Introduction to Java Programming Language

Java (12 Weeks) Introduction to Java Programming Language Java (12 Weeks) Topic Lecture No. Introduction to Java Programming Language 1 An Introduction to Java o Java as a Programming Platform, The Java "White Paper" Buzzwords, Java and the Internet, A Short

More information

Glossary of Object Oriented Terms

Glossary of Object Oriented Terms Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

More information

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science updated 03/08/2012 Unit 1: JKarel 8 weeks http://www.fcps.edu/is/pos/documents/hs/compsci.htm

More information

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters The char Type ASCII Encoding The C char type stores small integers. It is usually 8 bits. char variables guaranteed to be able to hold integers 0.. +127. char variables mostly used to store characters

More information

Introduction to Java

Introduction to Java Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

AP Computer Science Java Subset

AP Computer Science Java Subset APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

More information

#820 Computer Programming 1A

#820 Computer Programming 1A Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement Semester 1

More information

Tutorial on C Language Programming

Tutorial on C Language Programming Tutorial on C Language Programming Teodor Rus rus@cs.uiowa.edu The University of Iowa, Department of Computer Science Introduction to System Software p.1/64 Tutorial on C programming C program structure:

More information

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java

More information

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

More information

Computer Programming Tutorial

Computer Programming Tutorial Computer Programming Tutorial COMPUTER PROGRAMMING TUTORIAL by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Computer Prgramming Tutorial Computer programming is the act of writing computer

More information

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved.

Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved. 1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays

More information

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages ICOM 4036 Programming Languages Preliminaries Dr. Amirhossein Chinaei Dept. of Electrical & Computer Engineering UPRM Spring 2010 Language Evaluation Criteria Readability: the ease with which programs

More information

I PUC - Computer Science. Practical s Syllabus. Contents

I PUC - Computer Science. Practical s Syllabus. Contents I PUC - Computer Science Practical s Syllabus Contents Topics 1 Overview Of a Computer 1.1 Introduction 1.2 Functional Components of a computer (Working of each unit) 1.3 Evolution Of Computers 1.4 Generations

More information

Semantic Analysis: Types and Type Checking

Semantic Analysis: Types and Type Checking Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors

More information

Chapter 6: Programming Languages

Chapter 6: Programming Languages Chapter 6: Programming Languages Computer Science: An Overview Eleventh Edition by J. Glenn Brookshear Copyright 2012 Pearson Education, Inc. Chapter 6: Programming Languages 6.1 Historical Perspective

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq Introduction to Programming using Java wertyuiopasdfghjklzxcvbnmqwertyui

More information

Course Title: Software Development

Course Title: Software Development Course Title: Software Development Unit: Customer Service Content Standard(s) and Depth of 1. Analyze customer software needs and system requirements to design an information technology-based project plan.

More information

CS 106 Introduction to Computer Science I

CS 106 Introduction to Computer Science I CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper

More information

The Clean programming language. Group 25, Jingui Li, Daren Tuzi

The Clean programming language. Group 25, Jingui Li, Daren Tuzi The Clean programming language Group 25, Jingui Li, Daren Tuzi The Clean programming language Overview The Clean programming language first appeared in 1987 and is still being further developed. It was

More information

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science I. Basic Course Information RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE CISY 105 Foundations of Computer Science A. Course Number and Title: CISY-105, Foundations of Computer Science B. New

More information

PHP Tutorial From beginner to master

PHP Tutorial From beginner to master PHP Tutorial From beginner to master PHP is a powerful tool for making dynamic and interactive Web pages. PHP is the widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.

More information

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,

More information

Computer Programming I

Computer Programming I Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,

More information

How To Write Portable Programs In C

How To Write Portable Programs In C Writing Portable Programs COS 217 1 Goals of Today s Class Writing portable programs in C Sources of heterogeneity Data types, evaluation order, byte order, char set, Reading period and final exam Important

More information

NEW YORK CITY COLLEGE OF TECHNOLOGY/CUNY Computer Systems Technology Department

NEW YORK CITY COLLEGE OF TECHNOLOGY/CUNY Computer Systems Technology Department NEW YORK CITY COLLEGE OF TECHNOLOGY/CUNY Computer Systems Technology Department COURSE: CST1201 Programming Fundamentals (2 class hours, 2 lab hours, 3 credits) Course Description: This course is an intensive

More information

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

More information

UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming

UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming 1 2 Foreword First of all, this book isn t really for dummies. I wrote it for myself and other kids who are on the team. Everything

More information

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand: Introduction to Programming and Algorithms Module 2 CS 146 Sam Houston State University Dr. Tim McGuire Introduction To Computers And Java Chapter Objectives To understand: the meaning and placement of

More information

Java Application Developer Certificate Program Competencies

Java Application Developer Certificate Program Competencies Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle

More information

Course MS10975A Introduction to Programming. Length: 5 Days

Course MS10975A Introduction to Programming. Length: 5 Days 3 Riverchase Office Plaza Hoover, Alabama 35244 Phone: 205.989.4944 Fax: 855.317.2187 E-Mail: rwhitney@discoveritt.com Web: www.discoveritt.com Course MS10975A Introduction to Programming Length: 5 Days

More information

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Duration of Course: 6 Months Fees: Rs. 25,000/- (including Service Tax) Eligibility: B.E./B.Tech., M.Sc.(IT/ computer

More information

5 Arrays and Pointers

5 Arrays and Pointers 5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of

More information

An Incomplete C++ Primer. University of Wyoming MA 5310

An Incomplete C++ Primer. University of Wyoming MA 5310 An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages

More information

Programming Languages CIS 443

Programming Languages CIS 443 Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception

More information

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language Translation Translating to Java Introduction to Computer Programming The job of a programmer is to translate a problem description into a computer language. You need to be able to convert a problem description

More information

Ch 7-1. Object-Oriented Programming and Classes

Ch 7-1. Object-Oriented Programming and Classes 2014-1 Ch 7-1. Object-Oriented Programming and Classes May 10, 2014 Advanced Networking Technology Lab. (YU-ANTL) Dept. of Information & Comm. Eng, Graduate School, Yeungnam University, KOREA (Tel : +82-53-810-2497;

More information

Fundamentals of Java Programming

Fundamentals of Java Programming Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors

More information

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T) Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

More information

Java the UML Way: Integrating Object-Oriented Design and Programming

Java the UML Way: Integrating Object-Oriented Design and Programming Java the UML Way: Integrating Object-Oriented Design and Programming by Else Lervik and Vegard B. Havdal ISBN 0-470-84386-1 John Wiley & Sons, Ltd. Table of Contents Preface xi 1 Introduction 1 1.1 Preliminaries

More information

Programming and Software Development CTAG Alignments

Programming and Software Development CTAG Alignments Programming and Software Development CTAG Alignments This document contains information about four Career-Technical Articulation Numbers (CTANs) for Programming and Software Development Career-Technical

More information

AP Computer Science AB Syllabus 1

AP Computer Science AB Syllabus 1 AP Computer Science AB Syllabus 1 Course Resources Java Software Solutions for AP Computer Science, J. Lewis, W. Loftus, and C. Cocking, First Edition, 2004, Prentice Hall. Video: Sorting Out Sorting,

More information

/* File: blkcopy.c. size_t n

/* File: blkcopy.c. size_t n 13.1. BLOCK INPUT/OUTPUT 505 /* File: blkcopy.c The program uses block I/O to copy a file. */ #include main() { signed char buf[100] const void *ptr = (void *) buf FILE *input, *output size_t

More information

1 Introduction. 2 An Interpreter. 2.1 Handling Source Code

1 Introduction. 2 An Interpreter. 2.1 Handling Source Code 1 Introduction The purpose of this assignment is to write an interpreter for a small subset of the Lisp programming language. The interpreter should be able to perform simple arithmetic and comparisons

More information

COS 217: Introduction to Programming Systems

COS 217: Introduction to Programming Systems COS 217: Introduction to Programming Systems 1 Goals for Todayʼs Class Course overview Introductions Course goals Resources Grading Policies Getting started with C C programming language overview 2 1 Introductions

More information

6. Control Structures

6. Control Structures - 35 - Control Structures: 6. Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may bifurcate, repeat code or take decisions. For that purpose,

More information

PL / SQL Basics. Chapter 3

PL / SQL Basics. Chapter 3 PL / SQL Basics Chapter 3 PL / SQL Basics PL / SQL block Lexical units Variable declarations PL / SQL types Expressions and operators PL / SQL control structures PL / SQL style guide 2 PL / SQL Block Basic

More information

Basic Programming and PC Skills: Basic Programming and PC Skills:

Basic Programming and PC Skills: Basic Programming and PC Skills: Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of

More information

CSC230 Getting Starting in C. Tyler Bletsch

CSC230 Getting Starting in C. Tyler Bletsch CSC230 Getting Starting in C Tyler Bletsch What is C? The language of UNIX Procedural language (no classes) Low-level access to memory Easy to map to machine language Not much run-time stuff needed Surprisingly

More information

Semester Review. CSC 301, Fall 2015

Semester Review. CSC 301, Fall 2015 Semester Review CSC 301, Fall 2015 Programming Language Classes There are many different programming language classes, but four classes or paradigms stand out:! Imperative Languages! assignment and iteration!

More information

Programming Languages

Programming Languages Programming Languages Programming languages bridge the gap between people and machines; for that matter, they also bridge the gap among people who would like to share algorithms in a way that immediately

More information

Computer Programming I & II*

Computer Programming I & II* Computer Programming I & II* Career Cluster Information Technology Course Code 10152 Prerequisite(s) Computer Applications, Introduction to Information Technology Careers (recommended), Computer Hardware

More information

Comp151. Definitions & Declarations

Comp151. Definitions & Declarations Comp151 Definitions & Declarations Example: Definition /* reverse_printcpp */ #include #include using namespace std; int global_var = 23; // global variable definition void reverse_print(const

More information

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share. LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

More information

Domains and Competencies

Domains and Competencies Domains and Competencies DOMAIN I TECHNOLOGY APPLICATIONS CORE Standards Assessed: Computer Science 8 12 I VII Competency 001: The computer science teacher knows technology terminology and concepts; the

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.

JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system. http://www.tutorialspoint.com/java/java_quick_guide.htm JAVA - QUICK GUIDE Copyright tutorialspoint.com What is Java? Java is: Object Oriented Platform independent: Simple Secure Architectural- neutral

More information

CSCI 3136 Principles of Programming Languages

CSCI 3136 Principles of Programming Languages CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University Winter 2013 CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University

More information

Objective-C Tutorial

Objective-C Tutorial Objective-C Tutorial OBJECTIVE-C TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Objective-c tutorial Objective-C is a general-purpose, object-oriented programming

More information

C++FA 5.1 PRACTICE MID-TERM EXAM

C++FA 5.1 PRACTICE MID-TERM EXAM C++FA 5.1 PRACTICE MID-TERM EXAM This practicemid-term exam covers sections C++FA 1.1 through C++FA 1.4 of C++ with Financial Applications by Ben Van Vliet, available at www.benvanvliet.net. 1.) A pointer

More information

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands C Programming for Embedded Microcontrollers Warwick A. Smith Elektor International Media BV Postbus 11 6114ZG Susteren The Netherlands 3 the Table of Contents Introduction 11 Target Audience 11 What is

More information

Android Application Development Course Program

Android Application Development Course Program Android Application Development Course Program Part I Introduction to Programming 1. Introduction to programming. Compilers, interpreters, virtual machines. Primitive data types, variables, basic operators,

More information

Computer Programming I

Computer Programming I Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement (e.g. Exploring

More information

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science Program Schedule CTech Computer Science Credits CS101 Computer Science I 3 MATH100 Foundations of Mathematics and

More information

Stacks. Linear data structures

Stacks. Linear data structures Stacks Linear data structures Collection of components that can be arranged as a straight line Data structure grows or shrinks as we add or remove objects ADTs provide an abstract layer for various operations

More information

Fundamentals of Programming

Fundamentals of Programming Fundamentals of Programming Introduction to the C language Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 29, 2012 G. Lipari (Scuola Superiore Sant Anna) The C language

More information

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage Outline 1 Computer Architecture hardware components programming environments 2 Getting Started with Python installing Python executing Python code 3 Number Systems decimal and binary notations running

More information

C / C++ and Unix Programming. Materials adapted from Dan Hood and Dianna Xu

C / C++ and Unix Programming. Materials adapted from Dan Hood and Dianna Xu C / C++ and Unix Programming Materials adapted from Dan Hood and Dianna Xu 1 C and Unix Programming Today s goals ú History of C ú Basic types ú printf ú Arithmetic operations, types and casting ú Intro

More information

CS 241 Data Organization Coding Standards

CS 241 Data Organization Coding Standards CS 241 Data Organization Coding Standards Brooke Chenoweth University of New Mexico Spring 2016 CS-241 Coding Standards All projects and labs must follow the great and hallowed CS-241 coding standards.

More information

Curriculum Map. Discipline: Computer Science Course: C++

Curriculum Map. Discipline: Computer Science Course: C++ Curriculum Map Discipline: Computer Science Course: C++ August/September: How can computer programs make problem solving easier and more efficient? In what order does a computer execute the lines of code

More information

VB.NET Programming Fundamentals

VB.NET Programming Fundamentals Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements

More information

C++ Language Tutorial

C++ Language Tutorial cplusplus.com C++ Language Tutorial Written by: Juan Soulié Last revision: June, 2007 Available online at: http://www.cplusplus.com/doc/tutorial/ The online version is constantly revised and may contain

More information