SlideShare a Scribd company logo
1 of 45
Object-Oriented Programming Using C#
Rationale


               Object-oriented concepts form the base of all modern
               programming languages. Understanding the basic concepts
               of object-orientation helps a developer to use various
               modern day programming languages, more effectively. C#
               (C-Sharp) is an object-oriented programming language
               developed by Microsoft that intends to be a simple, modern,
               and general-purpose programming language for application
               development.
               The course is applicable to students who want to enter the
               world of object-oriented programming, using the C#
               language. This course provides a strong foundation in
               object-oriented programming approaches and the
               fundamentals of C# programming language.



    Ver. 1.0                      Session 1                        Slide 1 of 45
Object-Oriented Programming Using C#
Objectives


               In this session, you will learn to:
                  Explain features of the object-oriented methodology
                  Describe the phases of the object-oriented methodology
                  Define classes in C#
                  Declare variables
                  Write and execute C# programs




    Ver. 1.0                        Session 1                          Slide 2 of 45
Object-Oriented Programming Using C#
Object-Oriented Methodology


               Object orientation is a software development methodology
               that is based on modeling a real-world system.
               An object oriented program consists of classes and objects.

               Let us understand the terms—class and objects




    Ver. 1.0                      Session 1                        Slide 3 of 45
Object-Oriented Programming Using C#
Object-Oriented Methodology (Contd.)

                 Class
                                         Car




               Suzuki Reno     Toyota Camry    Honda Acura




                                  Objects


    Ver. 1.0                 Session 1               Slide 4 of 45
Object-Oriented Programming Using C#
The Foundation of Object Orientation


               An object means a ‘material thing’ that is capable of being
               presented to the senses.
               An object has the following characteristics:
                  It has a state
                  It may display behavior
                  It has a unique identity
               Objects interact with other objects through messages.

               Let us understand these concepts.




    Ver. 1.0                        Session 1                        Slide 5 of 45
Object-Oriented Programming Using C#
The Foundation of Object Orientation (Contd.)
Car positioned at one place defines it’s State




    Movement of car defines it’s Behavior


                                                Car number XX 4C 4546 shows
                                                the Identity of the car




     Ver. 1.0                       Session 1                           Slide 6 of 45
Object-Oriented Programming Using C#
The Foundation of Object Orientation (Contd.)


                    Car is flashing the lights to pass
                    the message to the other car




    Ver. 1.0                   Session 1                 Slide 7 of 45
Object-Oriented Programming Using C#
Just a minute


               Identify the possible states of the following objects:
                1. A cell phone
                2. A stereo




               Solution:
                1. States of a cell phone: Off, Ring, Vibrate, and Call
                2. States of a stereo: Play, Pause, Rewind, and Forward




    Ver. 1.0                        Session 1                             Slide 8 of 45
Object-Oriented Programming Using C#
Just a minute


               Dr. James and Mr. Hyde went to the railway station to book
               tickets for 3rd December. At the railway station, they
               requested the clerk at the ticket counter to book two tickets
               for the Flying Express in the first class. Identify the
               following:
                1. The possible receiver of the message in this situation.
                2. The possible method that the receiver can use.

               Solution:
                1. The receiver of the message in this case will be the clerk at
                   the ticket counter.
                2. The clerk will check if two tickets are available on the
                   requested train in the desired class and for the desired date. If
                   the tickets are available, the clerk will enter the details (name,
                   age, departure date, and seat), confirm the reservation, and
                   collect the required fare.
    Ver. 1.0                         Session 1                               Slide 9 of 45
Object-Oriented Programming Using C#
Characteristics of the Object-Oriented Approach


               Realistic modeling
               Reusability
               Resilience to change
               Existence as different forms




    Ver. 1.0                      Session 1       Slide 10 of 45
Object-Oriented Programming Using C#
Just a minute


               State whether the following situations demonstrate
               reusability:
                1. Recycling paper
                2. Pump reusability (same pump is used in a well and in a fuel
                   station)

               Solution:
                1. It does not represent reusability because the unusable paper
                   is destroyed before paper is recycled for use. The unusable
                   paper loses its identity and cannot be considered the same as
                   recycled paper.
                2. It represents reusability because a pump can be used for
                   suction of water as well as petrol. It is not necessary to use
                   the same pump in both the cases. Two separate machines
                   can be used because both belong to the ‘Pump’ class.


    Ver. 1.0                        Session 1                            Slide 11 of 45
Object-Oriented Programming Using C#
Phases of Object Orientation


               The following phases are involved in the software
               development:
                  The Analysis phase
                  The Design phase
                  The Implementation phase




               Let us discuss the process of constructing a building.




    Ver. 1.0                       Session 1                        Slide 12 of 45
Object-Oriented Programming Using C#
Just a minute


               As a member of a team that is developing software for
               DialCom Telecommunications, Inc., you have been
               assigned the task of creating a software module that
               accepts and displays customer details such as name, age,
               and phone number. Identify the class that you will create
               and the methods of the class.

               Solution:
                  As per the problem statement, the class required is:
                   – Customer
                  The class should have the methods to:
                      Accept customer details
                      Display customer details




    Ver. 1.0                         Session 1                           Slide 13 of 45
Object-Oriented Programming Using C#
Introducing C#


               A program is a set of instructions to perform a specific task.
               Programming languages use programs to develop software
               applications.
               A compiler is a special program that processes the
               statements written in a particular programming language
               and converts them into a machine language.
               This process of conversion is called compilation.




    Ver. 1.0                       Session 1                          Slide 14 of 45
Object-Oriented Programming Using C#
Introducing C# (Contd.)


               C#, also known as C-Sharp, is a programming language
               introduced by Microsoft.
               C# is specially designed to work with the Microsoft’s .NET
               platform.




               Let us understand the structure of a C# program.




    Ver. 1.0                      Session 1                        Slide 15 of 45
Object-Oriented Programming Using C#
Classes in C#


               Consider the following code example, which defines a class:
                public class Hello
                {
                  public static void Main(string[] args)
                  {
                       System.Console.WriteLine("Hello, World!
                         n");
                  }
                }




    Ver. 1.0                      Session 1                       Slide 16 of 45
Object-Oriented Programming Using C#
Classes in C# (Contd.)


               public class Hello               The class Keyword
               {                                Is used to declare a
                 public static void             class
                 Main(string[] args)
                 {
                   System.Console.WriteLine("He
                   llo, World! n");
                 }
               }




    Ver. 1.0                       Session 1                    Slide 17 of 45
Object-Oriented Programming Using C#
Classes in C# (Contd.)


               public class Hello               The class Name
               {                                Is used as an identifier
                 public static void             for a class
                 Main(string[] args)
                 {
                   System.Console.WriteLine("He
                   llo, World! n");
                 }
               }




    Ver. 1.0                       Session 1                      Slide 18 of 45
Object-Oriented Programming Using C#
Classes in C# (Contd.)


               public class Hello                 The Main() Function
               {                                  Is the entry point of an
                 public static void               application
                 Main(string[] args)
                                                  Is used to create
                 {                                objects and invoke
                   System.Console.WriteLine("He   member functions
                   llo, World! n");
                 }
               }




    Ver. 1.0                      Session 1                       Slide 19 of 45
Object-Oriented Programming Using C#
Classes in C# (Contd.)


               public class Hello                 System.Console.WriteLine()
               {                                  Displays the enclosed text on
                 public static void               the screen
                 Main(string[] args)
                 {

                       System.Console.WriteLine("He
                       llo, World! n");
                   }
               }




    Ver. 1.0                          Session 1                      Slide 20 of 45
Object-Oriented Programming Using C#
Classes in C# (Contd.)


               public class Hello                 The Escape Character
               {                                  Displays New line
                 public static void               character. Other special
                 Main(string[] args)              characters can also be
                 {                                displayed such as t, b
                   System.Console.WriteLine("He   and r
                   llo, World! n");
                 }
               }




    Ver. 1.0                      Session 1                       Slide 21 of 45
Object-Oriented Programming Using C#
Demo: Creating Classes


               Problem Statement:
                  As a member of a team that is developing toys for JoyToys,
                  Inc., you have been assigned the task of creating a bike
                  module that accepts and displays bike details. Declare the Bike
                  class and its member functions. The member function that
                  accepts bike details should display the message “Accepting
                  Bike Details”. Similarly, the member function to display bike
                  details on the screen should display the message “Displaying
                  Bike Details”.




    Ver. 1.0                       Session 1                            Slide 22 of 45
Object-Oriented Programming Using C#
Declaring Variables


               A variable is a location in the memory that has a name and
               contains a value.
               A variable is associated with a data type that defines the
               type of data that can be stored in a variable.




    Ver. 1.0                      Session 1                        Slide 23 of 45
Object-Oriented Programming Using C#
Declaring and Initializing Variables


                You can declare and initialize variables by using the
                following syntax:
                 <data_type> <variable_name>=<value>;




     Ver. 1.0                       Session 1                           Slide 24 of 45
Object-Oriented Programming Using C#
Declaring and Initializing Variables (Contd.)


                Consider the following        Data Types in C#
                example of declaring and      Represents the kind of
                initializing a variable:
                                              data stored in a variable
                int class_rank=2;
                                              C# provides you with
                                              various built-in data
                                              types, such as:
                                               • char
                                               • int
                                               • float
                                               • double
                                               • bool
                                               • string



     Ver. 1.0                     Session 1                        Slide 25 of 45
Object-Oriented Programming Using C#
Data Types in C#


               Let us now understand the various data types with the help
               of examples.




    Ver. 1.0                      Session 1                       Slide 26 of 45
Object-Oriented Programming Using C#
Data Types in C# (Contd.)




               string   Name = “Peter”

               float    Marks = 83.56
               int      Age   = 23
               char     Vowel = ‘a’




    Ver. 1.0                      Session 1   Slide 27 of 45
Object-Oriented Programming Using C#
Data Types in C# (Contd.)


               Consider the following               Data types in C#
               example of declaring and             The following types of
               initializing a variable:             data types are supported
               int class_rank=2;                    by C#:
                                                     • Value types

                                              int Num;
                                              Num
                                               Num=5;                            5


                                                          Memory allocated

                                             Variable declared and Initialized


                                                    Memory Allocation in Value Type




    Ver. 1.0                     Session 1                                           Slide 28 of 45
Object-Oriented Programming Using C#
Declaring and Initializing Variables


                Consider the following              Data types in C#
                example of declaring and            The following types of
                initializing a variable:            data types are supported
                int class_rank=2;                   by C#:
                                                     • Reference types

                                                   string Str=“Hello”;

                                                         Address         Str

                                                         H      E        L     L   O

                                                          0     1        2     3   4

                                              Memory Allocation of the String Type Variable




     Ver. 1.0                     Session 1                                            Slide 29 of 45
Object-Oriented Programming Using C#
Declaring and Initializing Variables (Contd.)


                Consider the following        Naming variables in C#
                example of declaring and      The following rules are used
                initializing a variable:      for naming variables in C#:
                int class_rank=2;              • Must begin with a letter or
                                                  an underscore
                                               • Should not contain any
                                                  embedded spaces or
                                                  symbols
                                               • Must be unique
                                               • Can have any number of
                                                  characters
                                               • Keywords cannot be used
                                                  as variable names


     Ver. 1.0                     Session 1                        Slide 30 of 45
Object-Oriented Programming Using C#
Declaring and Initializing Variables (Contd.)


                Consider the following          Examples and non-examples
                example of declaring and        of Naming Variables
                initializing a variable:
                                                 Name
                int class_rank=2;
                                                #Score


                                                 Age


                                                2Strank


                                              Family_Size


                                                 Gender



     Ver. 1.0                     Session 1                       Slide 31 of 45
Object-Oriented Programming Using C#
Declaring and Initializing Variables (Contd.)


                Consider the                      Initializing Variables in C#
                following example of              Specifies the value that
                declaring and                     needs to be stored in a
                initializing a variable:          variable. The value could be
                 int class_rank=2;                an integer, a decimal, or a
                                                  character.




     Ver. 1.0                         Session 1                       Slide 32 of 45
Object-Oriented Programming Using C#
Accepting and Storing Values in Member Variables


               To understand how to accept     Console.ReadLine()
               value in a variable, let us     Is used to accept input
               consider the following code     from the user and store it
               snippet:                        in the variable
               int Number;
               Number=
                 Convert.ToInt32(Console.Rea
                 dLine());




    Ver. 1.0                     Session 1                        Slide 33 of 45
Object-Oriented Programming Using C#
Accepting and Storing Values in Member Variables (Contd.)


               To understand how to accept     Convert.ToInt32()
               value in a variable, let us     Converts the value
               consider the following code     entered by the user to
               snippet:                        the int data type
               int Number;
               Number=
                 Convert.ToInt32(Console.Rea
                 dLine());




    Ver. 1.0                     Session 1                        Slide 34 of 45
Object-Oriented Programming Using C#
Writing and Executing a C# Program


               Let us know learn to write, compile, and execute a C#
               program.




    Ver. 1.0                      Session 1                        Slide 35 of 45
Object-Oriented Programming Using C#
Creating a Sample C# Program


               A C# program can be written by using an editor like
               Notepad. Consider the following code, which declares a
               class Car and also creates an object MyCar of the same
               class:                       The using keyword is used to include
                using System;                   the namespaces in the program.
                  class Car                     Comments are used to explain the
                  {                             code and are represented by //
                    //Member variables          symbols.
                    string Engine;              Member variables are used to store
                    int NoOfWheels;             the data for a class.
                    //Member functions          Member functions are declared inside
                     void AcceptDetails()       the class that are used to perform a
                                                specific task.




    Ver. 1.0                        Session 1                              Slide 36 of 45
Object-Oriented Programming Using C#
Creating a Sample C# Program (Contd.)


                   {
                       Console.WriteLine("Enter the Engine Model");
                       Engine = Console.ReadLine();
                       Console.WriteLine("Enter the number of Wheels");
                       NoOfWheels = Convert.ToInt32(Console.ReadLine());
                   }
                   public void DisplayDetails()
                   {
                     Console.WriteLine("The Engine Model is:{0}",
                     Engine);
                     Console.WriteLine("The number of wheels are:{0}",
                     NoOfWheels);
                   }
               }




    Ver. 1.0                      Session 1                      Slide 37 of 45
Object-Oriented Programming Using C#
Creating a Sample C# Program (Contd.)


               //Class used to instantiate the Car class
               class ExecuteClass     The Execute class is used as a class from
               {                      where the Car class can be instantiated.
                   public static void Main(string[] args)
                   {
                     Car MyCar = new Car();
                     MyCar.AcceptDetails();
                     MyCar.DisplayDetails();
                   }
               }




    Ver. 1.0                     Session 1                           Slide 38 of 45
Object-Oriented Programming Using C#
Compiling and Executing C# Program


               After writing the program in a Notepad, you need to compile
               and execute it to get the desired output.
               The compiler converts the source code that you write into
               the machine code, which the computer can understand.
               The following steps are needed to compile and execute a
               C# program.
                1. Save the code written in the Notepad with an extension .cs.
                2. To compile the code, you need to go to the Visual Studio
                   2005 Command Prompt window. Select StartAll
                   ProgramsMicrosoft Visual Studio 2005Visual Studio
                   ToolsVisual Studio 2005 Command Prompt. The Visual
                   Studio 2005 Command Prompt window is displayed to
                   compile the program.
                3. In the Visual Studio 2005 Command Prompt window, move
                   to the location where the programs file is saved.

    Ver. 1.0                       Session 1                           Slide 39 of 45
Object-Oriented Programming Using C#
Compiling and Executing C# Program (Contd.)


               4. Compile the program file by using the following command:
                   csc ExecuteClass.cs
               5. To execute the code, type the following in the command
                  prompt:
                   ExecuteClass.exe




    Ver. 1.0                       Session 1                          Slide 40 of 45
Object-Oriented Programming Using C#
Demo: Creating a C# Program


               Problem Statement:
                  David is the member of a team that is developing the
                  Automatic Ranking software for a tennis tournament. You have
                  been assigned the task of creating a program. The program
                  should accept the following details of a tennis player and
                  display it:
                   •   Name, containing a maximum of 25 characters
                   •   Rank as an integer
                   •   Winning average as a decimal value
                  Help David to create the program.




    Ver. 1.0                         Session 1                        Slide 41 of 45
Object-Oriented Programming Using C#
Summary


              In this session, you learned that:
                 According to the object-oriented approach, systems consist of
                 component objects that interact with each other.
                 An object is an entity that may have a physical boundary.
                 However, it should have the following characteristics:
                   • State
                   • Behavior
                   • Identity
               – A class consists of a set of objects that share a common
                 structure and behavior.
               – If an object desires an action from another object, it sends a
                 message to that object.
               – The object that receives the message is called the receiver,
                 and the set of actions taken by the receiver constitutes the
                 method.

   Ver. 1.0                         Session 1                            Slide 42 of 45
Object-Oriented Programming Using C#
Summary (Contd.)


                 The features of the object-oriented approach are:
                   •   Realistic modeling
                   •   Reusability
                   •   Resilience to change
                   •   Existence as different forms
               – A model of a system is built in the stages of analysis, design
                 and implementation.
               – The purpose of the model is to help developers understand the
                 reality that they are trying to imitate.
               – In C#, a class is created by using the keyword class. It is
                 identified by a name called the class name.
               – The Console.WriteLine() method is used to display text on the
                 screen.
               – Main() is the first function which is executed in a C# program.



    Ver. 1.0                          Session 1                         Slide 43 of 45
Object-Oriented Programming Using C#
Summary (Contd.)


               Escape characters are used to display special characters such
               as the newline character.
               A variable is a named location in the memory, which contains a
               specific value.
               A datatype defines the type of data that can be stored in a
               variable.
               The two types of data type are Value type and Reference type.
               The ReadLine() method is used to accept inputs from the
               user.
               The using keyword is used to include the namespaces in the
               program.
               A namespace contains a set of related classes.
               Member variables are declared inside the class body.




    Ver. 1.0                    Session 1                           Slide 44 of 45
Object-Oriented Programming Using C#
Summary (Contd.)


               Comment entries are notes written by a programmer in the
               code so that others reading that code can understand it better.
               An object is an instance of a class.
               The compiler software translates a program written in a
               language like C# into the machine language.




    Ver. 1.0                     Session 1                            Slide 45 of 45

More Related Content

Viewers also liked

Viewers also liked (20)

02 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_0202 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_02
 
02 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_0202 iec t1_s1_oo_ps_session_02
02 iec t1_s1_oo_ps_session_02
 
OnSpotAward_TDMS_team
OnSpotAward_TDMS_teamOnSpotAward_TDMS_team
OnSpotAward_TDMS_team
 
7g
7g7g
7g
 
C programming tutorial for beginners
C programming tutorial for beginnersC programming tutorial for beginners
C programming tutorial for beginners
 
C programming
C programmingC programming
C programming
 
03 the c language
03 the c language03 the c language
03 the c language
 
C tutorial
C tutorialC tutorial
C tutorial
 
Li fi
Li fiLi fi
Li fi
 
01 iec t1_s1_plt_session_01
01 iec t1_s1_plt_session_0101 iec t1_s1_plt_session_01
01 iec t1_s1_plt_session_01
 
SAP BI 7 security concepts
SAP BI 7 security conceptsSAP BI 7 security concepts
SAP BI 7 security concepts
 
Niit
NiitNiit
Niit
 
CCNA Interview Questions and Answer ppt - JavaTpoint
CCNA Interview Questions and Answer ppt - JavaTpointCCNA Interview Questions and Answer ppt - JavaTpoint
CCNA Interview Questions and Answer ppt - JavaTpoint
 
C the basic concepts
C the basic conceptsC the basic concepts
C the basic concepts
 
Wireless technology from 0G to 7.5G
Wireless technology from 0G to 7.5GWireless technology from 0G to 7.5G
Wireless technology from 0G to 7.5G
 
Overview of c language
Overview of c languageOverview of c language
Overview of c language
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
Android ppt
Android pptAndroid ppt
Android ppt
 
C ppt
C pptC ppt
C ppt
 
C Programming Language Part 6
C Programming Language Part 6C Programming Language Part 6
C Programming Language Part 6
 

Similar to 01 iec t1_s1_oo_ps_session_01

07 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_1007 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_10Niit Care
 
05 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_0705 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_07Niit Care
 
Object Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming languageObject Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming languageGeorges Abboudeh
 
06 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_0806 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_08Niit Care
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05Niit Care
 
12 iec t1_s1_oo_ps_session_17
12 iec t1_s1_oo_ps_session_1712 iec t1_s1_oo_ps_session_17
12 iec t1_s1_oo_ps_session_17Niit Care
 
Event Driven Programming in C#.docx
Event Driven Programming in C#.docxEvent Driven Programming in C#.docx
Event Driven Programming in C#.docxLenchoMamudeBaro
 
Write native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTWrite native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTAtit Patumvan
 
11 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_1611 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_16Niit Care
 
Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design patternchetankane
 
Presentation [autosaved] unacademy
Presentation [autosaved] unacademyPresentation [autosaved] unacademy
Presentation [autosaved] unacademyRohitSingh1405
 
Oop c sharp_part_1
Oop c sharp_part_1Oop c sharp_part_1
Oop c sharp_part_1shivaksn
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...NicheTech Com. Solutions Pvt. Ltd.
 
Btec level 3 ass 1 u4 5 and 62
Btec level 3 ass 1 u4 5 and 62Btec level 3 ass 1 u4 5 and 62
Btec level 3 ass 1 u4 5 and 62inghamjamie
 
New Features in Dotnet Niku Software
New Features in Dotnet Niku SoftwareNew Features in Dotnet Niku Software
New Features in Dotnet Niku SoftwareJaganathRao
 
Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)Wes Yanaga
 
Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)John Smith
 

Similar to 01 iec t1_s1_oo_ps_session_01 (20)

07 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_1007 iec t1_s1_oo_ps_session_10
07 iec t1_s1_oo_ps_session_10
 
C#
C#C#
C#
 
05 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_0705 iec t1_s1_oo_ps_session_07
05 iec t1_s1_oo_ps_session_07
 
Object Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming languageObject Oriented Software Development, using c# programming language
Object Oriented Software Development, using c# programming language
 
C# handout.docx
C# handout.docxC# handout.docx
C# handout.docx
 
06 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_0806 iec t1_s1_oo_ps_session_08
06 iec t1_s1_oo_ps_session_08
 
04 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_0504 iec t1_s1_oo_ps_session_05
04 iec t1_s1_oo_ps_session_05
 
12 iec t1_s1_oo_ps_session_17
12 iec t1_s1_oo_ps_session_1712 iec t1_s1_oo_ps_session_17
12 iec t1_s1_oo_ps_session_17
 
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
 
Event Driven Programming in C#.docx
Event Driven Programming in C#.docxEvent Driven Programming in C#.docx
Event Driven Programming in C#.docx
 
Write native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDTWrite native iPhone applications using Eclipse CDT
Write native iPhone applications using Eclipse CDT
 
11 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_1611 iec t1_s1_oo_ps_session_16
11 iec t1_s1_oo_ps_session_16
 
Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design pattern
 
Presentation [autosaved] unacademy
Presentation [autosaved] unacademyPresentation [autosaved] unacademy
Presentation [autosaved] unacademy
 
Oop c sharp_part_1
Oop c sharp_part_1Oop c sharp_part_1
Oop c sharp_part_1
 
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
Objective of c in IOS , iOS Live Project Training Ahmedabad, MCA Live Project...
 
Btec level 3 ass 1 u4 5 and 62
Btec level 3 ass 1 u4 5 and 62Btec level 3 ass 1 u4 5 and 62
Btec level 3 ass 1 u4 5 and 62
 
New Features in Dotnet Niku Software
New Features in Dotnet Niku SoftwareNew Features in Dotnet Niku Software
New Features in Dotnet Niku Software
 
Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)
 
Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)Intro to c# (vs. objective c and java)
Intro to c# (vs. objective c and java)
 

More from Niit Care (20)

Ajs 1 b
Ajs 1 bAjs 1 b
Ajs 1 b
 
Ajs 4 b
Ajs 4 bAjs 4 b
Ajs 4 b
 
Ajs 4 a
Ajs 4 aAjs 4 a
Ajs 4 a
 
Ajs 4 c
Ajs 4 cAjs 4 c
Ajs 4 c
 
Ajs 3 b
Ajs 3 bAjs 3 b
Ajs 3 b
 
Ajs 3 a
Ajs 3 aAjs 3 a
Ajs 3 a
 
Ajs 3 c
Ajs 3 cAjs 3 c
Ajs 3 c
 
Ajs 2 b
Ajs 2 bAjs 2 b
Ajs 2 b
 
Ajs 2 a
Ajs 2 aAjs 2 a
Ajs 2 a
 
Ajs 2 c
Ajs 2 cAjs 2 c
Ajs 2 c
 
Ajs 1 a
Ajs 1 aAjs 1 a
Ajs 1 a
 
Ajs 1 c
Ajs 1 cAjs 1 c
Ajs 1 c
 
Dacj 4 2-c
Dacj 4 2-cDacj 4 2-c
Dacj 4 2-c
 
Dacj 4 2-b
Dacj 4 2-bDacj 4 2-b
Dacj 4 2-b
 
Dacj 4 2-a
Dacj 4 2-aDacj 4 2-a
Dacj 4 2-a
 
Dacj 4 1-c
Dacj 4 1-cDacj 4 1-c
Dacj 4 1-c
 
Dacj 4 1-b
Dacj 4 1-bDacj 4 1-b
Dacj 4 1-b
 
Dacj 4 1-a
Dacj 4 1-aDacj 4 1-a
Dacj 4 1-a
 
Dacj 1-2 b
Dacj 1-2 bDacj 1-2 b
Dacj 1-2 b
 
Dacj 1-3 c
Dacj 1-3 cDacj 1-3 c
Dacj 1-3 c
 

Recently uploaded

[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesExploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesSanjay Willie
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Fact vs. Fiction: Autodetecting Hallucinations in LLMs
Fact vs. Fiction: Autodetecting Hallucinations in LLMsFact vs. Fiction: Autodetecting Hallucinations in LLMs
Fact vs. Fiction: Autodetecting Hallucinations in LLMsZilliz
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 

Recently uploaded (20)

[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your QueriesExploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
Exploring ChatGPT Prompt Hacks To Maximally Optimise Your Queries
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Fact vs. Fiction: Autodetecting Hallucinations in LLMs
Fact vs. Fiction: Autodetecting Hallucinations in LLMsFact vs. Fiction: Autodetecting Hallucinations in LLMs
Fact vs. Fiction: Autodetecting Hallucinations in LLMs
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 

01 iec t1_s1_oo_ps_session_01

  • 1. Object-Oriented Programming Using C# Rationale Object-oriented concepts form the base of all modern programming languages. Understanding the basic concepts of object-orientation helps a developer to use various modern day programming languages, more effectively. C# (C-Sharp) is an object-oriented programming language developed by Microsoft that intends to be a simple, modern, and general-purpose programming language for application development. The course is applicable to students who want to enter the world of object-oriented programming, using the C# language. This course provides a strong foundation in object-oriented programming approaches and the fundamentals of C# programming language. Ver. 1.0 Session 1 Slide 1 of 45
  • 2. Object-Oriented Programming Using C# Objectives In this session, you will learn to: Explain features of the object-oriented methodology Describe the phases of the object-oriented methodology Define classes in C# Declare variables Write and execute C# programs Ver. 1.0 Session 1 Slide 2 of 45
  • 3. Object-Oriented Programming Using C# Object-Oriented Methodology Object orientation is a software development methodology that is based on modeling a real-world system. An object oriented program consists of classes and objects. Let us understand the terms—class and objects Ver. 1.0 Session 1 Slide 3 of 45
  • 4. Object-Oriented Programming Using C# Object-Oriented Methodology (Contd.) Class Car Suzuki Reno Toyota Camry Honda Acura Objects Ver. 1.0 Session 1 Slide 4 of 45
  • 5. Object-Oriented Programming Using C# The Foundation of Object Orientation An object means a ‘material thing’ that is capable of being presented to the senses. An object has the following characteristics: It has a state It may display behavior It has a unique identity Objects interact with other objects through messages. Let us understand these concepts. Ver. 1.0 Session 1 Slide 5 of 45
  • 6. Object-Oriented Programming Using C# The Foundation of Object Orientation (Contd.) Car positioned at one place defines it’s State Movement of car defines it’s Behavior Car number XX 4C 4546 shows the Identity of the car Ver. 1.0 Session 1 Slide 6 of 45
  • 7. Object-Oriented Programming Using C# The Foundation of Object Orientation (Contd.) Car is flashing the lights to pass the message to the other car Ver. 1.0 Session 1 Slide 7 of 45
  • 8. Object-Oriented Programming Using C# Just a minute Identify the possible states of the following objects: 1. A cell phone 2. A stereo Solution: 1. States of a cell phone: Off, Ring, Vibrate, and Call 2. States of a stereo: Play, Pause, Rewind, and Forward Ver. 1.0 Session 1 Slide 8 of 45
  • 9. Object-Oriented Programming Using C# Just a minute Dr. James and Mr. Hyde went to the railway station to book tickets for 3rd December. At the railway station, they requested the clerk at the ticket counter to book two tickets for the Flying Express in the first class. Identify the following: 1. The possible receiver of the message in this situation. 2. The possible method that the receiver can use. Solution: 1. The receiver of the message in this case will be the clerk at the ticket counter. 2. The clerk will check if two tickets are available on the requested train in the desired class and for the desired date. If the tickets are available, the clerk will enter the details (name, age, departure date, and seat), confirm the reservation, and collect the required fare. Ver. 1.0 Session 1 Slide 9 of 45
  • 10. Object-Oriented Programming Using C# Characteristics of the Object-Oriented Approach Realistic modeling Reusability Resilience to change Existence as different forms Ver. 1.0 Session 1 Slide 10 of 45
  • 11. Object-Oriented Programming Using C# Just a minute State whether the following situations demonstrate reusability: 1. Recycling paper 2. Pump reusability (same pump is used in a well and in a fuel station) Solution: 1. It does not represent reusability because the unusable paper is destroyed before paper is recycled for use. The unusable paper loses its identity and cannot be considered the same as recycled paper. 2. It represents reusability because a pump can be used for suction of water as well as petrol. It is not necessary to use the same pump in both the cases. Two separate machines can be used because both belong to the ‘Pump’ class. Ver. 1.0 Session 1 Slide 11 of 45
  • 12. Object-Oriented Programming Using C# Phases of Object Orientation The following phases are involved in the software development: The Analysis phase The Design phase The Implementation phase Let us discuss the process of constructing a building. Ver. 1.0 Session 1 Slide 12 of 45
  • 13. Object-Oriented Programming Using C# Just a minute As a member of a team that is developing software for DialCom Telecommunications, Inc., you have been assigned the task of creating a software module that accepts and displays customer details such as name, age, and phone number. Identify the class that you will create and the methods of the class. Solution: As per the problem statement, the class required is: – Customer The class should have the methods to: Accept customer details Display customer details Ver. 1.0 Session 1 Slide 13 of 45
  • 14. Object-Oriented Programming Using C# Introducing C# A program is a set of instructions to perform a specific task. Programming languages use programs to develop software applications. A compiler is a special program that processes the statements written in a particular programming language and converts them into a machine language. This process of conversion is called compilation. Ver. 1.0 Session 1 Slide 14 of 45
  • 15. Object-Oriented Programming Using C# Introducing C# (Contd.) C#, also known as C-Sharp, is a programming language introduced by Microsoft. C# is specially designed to work with the Microsoft’s .NET platform. Let us understand the structure of a C# program. Ver. 1.0 Session 1 Slide 15 of 45
  • 16. Object-Oriented Programming Using C# Classes in C# Consider the following code example, which defines a class: public class Hello { public static void Main(string[] args) { System.Console.WriteLine("Hello, World! n"); } } Ver. 1.0 Session 1 Slide 16 of 45
  • 17. Object-Oriented Programming Using C# Classes in C# (Contd.) public class Hello The class Keyword { Is used to declare a public static void class Main(string[] args) { System.Console.WriteLine("He llo, World! n"); } } Ver. 1.0 Session 1 Slide 17 of 45
  • 18. Object-Oriented Programming Using C# Classes in C# (Contd.) public class Hello The class Name { Is used as an identifier public static void for a class Main(string[] args) { System.Console.WriteLine("He llo, World! n"); } } Ver. 1.0 Session 1 Slide 18 of 45
  • 19. Object-Oriented Programming Using C# Classes in C# (Contd.) public class Hello The Main() Function { Is the entry point of an public static void application Main(string[] args) Is used to create { objects and invoke System.Console.WriteLine("He member functions llo, World! n"); } } Ver. 1.0 Session 1 Slide 19 of 45
  • 20. Object-Oriented Programming Using C# Classes in C# (Contd.) public class Hello System.Console.WriteLine() { Displays the enclosed text on public static void the screen Main(string[] args) { System.Console.WriteLine("He llo, World! n"); } } Ver. 1.0 Session 1 Slide 20 of 45
  • 21. Object-Oriented Programming Using C# Classes in C# (Contd.) public class Hello The Escape Character { Displays New line public static void character. Other special Main(string[] args) characters can also be { displayed such as t, b System.Console.WriteLine("He and r llo, World! n"); } } Ver. 1.0 Session 1 Slide 21 of 45
  • 22. Object-Oriented Programming Using C# Demo: Creating Classes Problem Statement: As a member of a team that is developing toys for JoyToys, Inc., you have been assigned the task of creating a bike module that accepts and displays bike details. Declare the Bike class and its member functions. The member function that accepts bike details should display the message “Accepting Bike Details”. Similarly, the member function to display bike details on the screen should display the message “Displaying Bike Details”. Ver. 1.0 Session 1 Slide 22 of 45
  • 23. Object-Oriented Programming Using C# Declaring Variables A variable is a location in the memory that has a name and contains a value. A variable is associated with a data type that defines the type of data that can be stored in a variable. Ver. 1.0 Session 1 Slide 23 of 45
  • 24. Object-Oriented Programming Using C# Declaring and Initializing Variables You can declare and initialize variables by using the following syntax: <data_type> <variable_name>=<value>; Ver. 1.0 Session 1 Slide 24 of 45
  • 25. Object-Oriented Programming Using C# Declaring and Initializing Variables (Contd.) Consider the following Data Types in C# example of declaring and Represents the kind of initializing a variable: data stored in a variable int class_rank=2; C# provides you with various built-in data types, such as: • char • int • float • double • bool • string Ver. 1.0 Session 1 Slide 25 of 45
  • 26. Object-Oriented Programming Using C# Data Types in C# Let us now understand the various data types with the help of examples. Ver. 1.0 Session 1 Slide 26 of 45
  • 27. Object-Oriented Programming Using C# Data Types in C# (Contd.) string Name = “Peter” float Marks = 83.56 int Age = 23 char Vowel = ‘a’ Ver. 1.0 Session 1 Slide 27 of 45
  • 28. Object-Oriented Programming Using C# Data Types in C# (Contd.) Consider the following Data types in C# example of declaring and The following types of initializing a variable: data types are supported int class_rank=2; by C#: • Value types int Num; Num Num=5; 5 Memory allocated Variable declared and Initialized Memory Allocation in Value Type Ver. 1.0 Session 1 Slide 28 of 45
  • 29. Object-Oriented Programming Using C# Declaring and Initializing Variables Consider the following Data types in C# example of declaring and The following types of initializing a variable: data types are supported int class_rank=2; by C#: • Reference types string Str=“Hello”; Address Str H E L L O 0 1 2 3 4 Memory Allocation of the String Type Variable Ver. 1.0 Session 1 Slide 29 of 45
  • 30. Object-Oriented Programming Using C# Declaring and Initializing Variables (Contd.) Consider the following Naming variables in C# example of declaring and The following rules are used initializing a variable: for naming variables in C#: int class_rank=2; • Must begin with a letter or an underscore • Should not contain any embedded spaces or symbols • Must be unique • Can have any number of characters • Keywords cannot be used as variable names Ver. 1.0 Session 1 Slide 30 of 45
  • 31. Object-Oriented Programming Using C# Declaring and Initializing Variables (Contd.) Consider the following Examples and non-examples example of declaring and of Naming Variables initializing a variable: Name int class_rank=2; #Score Age 2Strank Family_Size Gender Ver. 1.0 Session 1 Slide 31 of 45
  • 32. Object-Oriented Programming Using C# Declaring and Initializing Variables (Contd.) Consider the Initializing Variables in C# following example of Specifies the value that declaring and needs to be stored in a initializing a variable: variable. The value could be int class_rank=2; an integer, a decimal, or a character. Ver. 1.0 Session 1 Slide 32 of 45
  • 33. Object-Oriented Programming Using C# Accepting and Storing Values in Member Variables To understand how to accept Console.ReadLine() value in a variable, let us Is used to accept input consider the following code from the user and store it snippet: in the variable int Number; Number= Convert.ToInt32(Console.Rea dLine()); Ver. 1.0 Session 1 Slide 33 of 45
  • 34. Object-Oriented Programming Using C# Accepting and Storing Values in Member Variables (Contd.) To understand how to accept Convert.ToInt32() value in a variable, let us Converts the value consider the following code entered by the user to snippet: the int data type int Number; Number= Convert.ToInt32(Console.Rea dLine()); Ver. 1.0 Session 1 Slide 34 of 45
  • 35. Object-Oriented Programming Using C# Writing and Executing a C# Program Let us know learn to write, compile, and execute a C# program. Ver. 1.0 Session 1 Slide 35 of 45
  • 36. Object-Oriented Programming Using C# Creating a Sample C# Program A C# program can be written by using an editor like Notepad. Consider the following code, which declares a class Car and also creates an object MyCar of the same class: The using keyword is used to include using System; the namespaces in the program. class Car Comments are used to explain the { code and are represented by // //Member variables symbols. string Engine; Member variables are used to store int NoOfWheels; the data for a class. //Member functions Member functions are declared inside void AcceptDetails() the class that are used to perform a specific task. Ver. 1.0 Session 1 Slide 36 of 45
  • 37. Object-Oriented Programming Using C# Creating a Sample C# Program (Contd.) { Console.WriteLine("Enter the Engine Model"); Engine = Console.ReadLine(); Console.WriteLine("Enter the number of Wheels"); NoOfWheels = Convert.ToInt32(Console.ReadLine()); } public void DisplayDetails() { Console.WriteLine("The Engine Model is:{0}", Engine); Console.WriteLine("The number of wheels are:{0}", NoOfWheels); } } Ver. 1.0 Session 1 Slide 37 of 45
  • 38. Object-Oriented Programming Using C# Creating a Sample C# Program (Contd.) //Class used to instantiate the Car class class ExecuteClass The Execute class is used as a class from { where the Car class can be instantiated. public static void Main(string[] args) { Car MyCar = new Car(); MyCar.AcceptDetails(); MyCar.DisplayDetails(); } } Ver. 1.0 Session 1 Slide 38 of 45
  • 39. Object-Oriented Programming Using C# Compiling and Executing C# Program After writing the program in a Notepad, you need to compile and execute it to get the desired output. The compiler converts the source code that you write into the machine code, which the computer can understand. The following steps are needed to compile and execute a C# program. 1. Save the code written in the Notepad with an extension .cs. 2. To compile the code, you need to go to the Visual Studio 2005 Command Prompt window. Select StartAll ProgramsMicrosoft Visual Studio 2005Visual Studio ToolsVisual Studio 2005 Command Prompt. The Visual Studio 2005 Command Prompt window is displayed to compile the program. 3. In the Visual Studio 2005 Command Prompt window, move to the location where the programs file is saved. Ver. 1.0 Session 1 Slide 39 of 45
  • 40. Object-Oriented Programming Using C# Compiling and Executing C# Program (Contd.) 4. Compile the program file by using the following command: csc ExecuteClass.cs 5. To execute the code, type the following in the command prompt: ExecuteClass.exe Ver. 1.0 Session 1 Slide 40 of 45
  • 41. Object-Oriented Programming Using C# Demo: Creating a C# Program Problem Statement: David is the member of a team that is developing the Automatic Ranking software for a tennis tournament. You have been assigned the task of creating a program. The program should accept the following details of a tennis player and display it: • Name, containing a maximum of 25 characters • Rank as an integer • Winning average as a decimal value Help David to create the program. Ver. 1.0 Session 1 Slide 41 of 45
  • 42. Object-Oriented Programming Using C# Summary In this session, you learned that: According to the object-oriented approach, systems consist of component objects that interact with each other. An object is an entity that may have a physical boundary. However, it should have the following characteristics: • State • Behavior • Identity – A class consists of a set of objects that share a common structure and behavior. – If an object desires an action from another object, it sends a message to that object. – The object that receives the message is called the receiver, and the set of actions taken by the receiver constitutes the method. Ver. 1.0 Session 1 Slide 42 of 45
  • 43. Object-Oriented Programming Using C# Summary (Contd.) The features of the object-oriented approach are: • Realistic modeling • Reusability • Resilience to change • Existence as different forms – A model of a system is built in the stages of analysis, design and implementation. – The purpose of the model is to help developers understand the reality that they are trying to imitate. – In C#, a class is created by using the keyword class. It is identified by a name called the class name. – The Console.WriteLine() method is used to display text on the screen. – Main() is the first function which is executed in a C# program. Ver. 1.0 Session 1 Slide 43 of 45
  • 44. Object-Oriented Programming Using C# Summary (Contd.) Escape characters are used to display special characters such as the newline character. A variable is a named location in the memory, which contains a specific value. A datatype defines the type of data that can be stored in a variable. The two types of data type are Value type and Reference type. The ReadLine() method is used to accept inputs from the user. The using keyword is used to include the namespaces in the program. A namespace contains a set of related classes. Member variables are declared inside the class body. Ver. 1.0 Session 1 Slide 44 of 45
  • 45. Object-Oriented Programming Using C# Summary (Contd.) Comment entries are notes written by a programmer in the code so that others reading that code can understand it better. An object is an instance of a class. The compiler software translates a program written in a language like C# into the machine language. Ver. 1.0 Session 1 Slide 45 of 45

Editor's Notes

  1. Students have learnt the structure of different types of dimensions and the importance of surrogate keys in Module I. In this session, students will learn to load the data into the dimension tables after the data has been transformed in the transformation phase. In addition, students will also learn to update data into these dimension tables. Students already know about different types of dimension tables. Therefore, you can start the session by recapitulating the concepts. Initiate the class by asking the following questions: 1. What are the different types of dimensions? 2. Define flat dimension. 3. What are conformed dimension? 4. Define large dimension. 5. Define small dimension. 6. What is the importance of surrogate key in a dimension table? Students will learn the loading and update strategies theoretically in this session. The demonstration to load and update the data in the dimension table will be covered in next session.
  2. Students have learnt the structure of different types of dimensions and the importance of surrogate keys in Module I. In this session, students will learn to load the data into the dimension tables after the data has been transformed in the transformation phase. In addition, students will also learn to update data into these dimension tables. Students already know about different types of dimension tables. Therefore, you can start the session by recapitulating the concepts. Initiate the class by asking the following questions: 1. What are the different types of dimensions? 2. Define flat dimension. 3. What are conformed dimension? 4. Define large dimension. 5. Define small dimension. 6. What is the importance of surrogate key in a dimension table? Students will learn the loading and update strategies theoretically in this session. The demonstration to load and update the data in the dimension table will be covered in next session.
  3. Students know the importance of surrogate keys. In this session students will learn the strategy to generate the surrogate key. Give an example to explain the strategy to generate the surrogate keys by concatenating the primary key of the source table with the date stamp. For example, data from a Product table has to be loaded into the Product_Dim dimension table on Feb 09, 2006. The product_code is the primary key column in the Product table. To insert the surrogate key values before loading the data into the dimension table, you can combine the primary key value with the date on which the data has to be loaded. In this case the surrogate key value can be product_code+09022006.
  4. Students know what is the structure of Flat dimension. You can initiate the session by asking the following questions: 1. What are flat dimension tables? 2. What is the structure of flat dimension? 3. Given examples of a flat dimension? Next, tell the strategy to load the data into the flat dimension table. You can explain the loading strategy with the help of the example given in SG. Continue this session by asking the following questions: 4. What are large flat dimension tables? 5. Give examples of large flat dimensions? Then, explain the strategy to load data into the large flat dimension table. Before explaining the strategy to load data into the small dimension table ask the following questions and the tell the strategy to load the data into the dimension table. 6. What are small flat dimension tables? 7. Give examples of small flat dimension tables. With the help of these questions, students will be able to recall about flat dimensions, they have learnt in Module I. Explain this topic with the help of an example given in SG.
  5. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  6. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  7. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  8. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  9. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  10. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  11. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  12. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  13. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  14. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  15. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  16. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  17. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  18. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  19. Student already have learnt about SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 1 SCDs? Given an example to explain type 1 SCDs. This will recapitulate what they have learnt about type 1 SCD in Module 1. Now explain the strategy to load the data into these dimension tables with help of the given diagram. Relate this diagram to the example given in SG.
  20. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  21. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  22. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  23. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  24. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  25. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  26. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  27. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  28. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  29. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  30. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  31. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  32. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  33. Student already have learnt about type 2 SCDs in Module I. Therefore, you can start this topic by asking the following questions to students: What are type 2 SCDs? Given an example to explain type 2 SCDs. This will recapitulate what they have learnt about type 2 SCD in Module 1. Now explain the strategy to update the data into these dimension tables with help the example given in SG. After explaining the examples, you can ask students to think of an example of a type 2 SCD and then tell the strategy to update the data into this dimension table.
  34. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  35. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  36. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.
  37. You can summarize the session by running through the summary given in SG. In addition, you can also ask students summarize what they have learnt in this session.