NOIDATUT E Leaning Platform

Size: px
Start display at page:

Download "NOIDATUT E Leaning Platform"

Transcription

1 NOIDATUT E Leaning Platform Dot Net Framework Lab Manual COMPUTER SCIENCE AND ENGINEERING Presented by: NOIDATUT e-learn@noidatut.com

2 C SHARP 1. Program to display Hello World in C Sharp 2. Program to illustrate Comments in C Sharp 3. Program to illustrate Data Types in C Sharp 4. Program to illustrate Ennumerations in C Sharp 5. Program to illustrate Arrays in C Sharp 6. Program to illustrate variables and constant 7. Program to illustrate Expressions in C Sharp 8. Program to illustrate loops and statements in C Sharp 9. Program to illustrate structures in C Sharp 10. Program to illustrate Class in C Sharp 11. Program to illustrate abstract Class in C Sharp 12. Program to implement inheritance in C Sharp 13. Program to illustrate exception handling in C Sharp 14. Program to create custom exception handling in C Sharp 15. Program to illustrate the use of delegates in C Sharp 16. Program to illustrate the use of events in C Sharp C SHARP LAB MANUAL 2 1. Program to display Hello World in C Sharp using System; public class HelloWorld

3 public static void Main() Console.WriteLine("Hello World in C#"); C# classes are stored in.cs files. After you have saved the preceding program in a file, let's say Hello World, you can compile the program into a.net executable. You will need to include the.net Framework SDK's bin folder in your PATH variable. If you have installed Visual Studio.NET, you have a shortcut under Visual Studio.NET Tools called Visual Studio.NET 2003 Command Prompt. This shortcut initializes all the environment variables and provides access to the command-line compilers as well. csc HelloWorld.cs Now enter HelloWorld.exe to run the application, and you should see "Hello World in C#" echoed on the screen C SHARP LAB MANUAL 3 2. Program to illustrate Comments in C Sharp using System; / <summary> / A Simple Class / </summary>

4 public class Comments public static void Main() / A Simple comment /* A multi line comment */ C#"); Console.WriteLine("Hello World in NOIDATUT.COM - E LEARNING PLATFORM C SHARP LAB MANUAL 4 3. Program to illustrate Data Types in C Sharp C# Type Corresponding.NET Framework Type Bool System.Boolean

5 byte, sbyte Char System.Byte, System.SByte System.Char decimal, double, System.Decimal, System.Double, Single short, ushort, System.Single System.Int16, System.UInt16, int, uint, long, System.Int32, System.UInt32, Ulong Object String System.Int64, System.UInt64 System.Object System.String C SHARP LAB MANUAL 5 4. Program to illustrate Ennumerations in C Sharp using System; public class UseEnumerations

6 enum CreditCard Visa = 0, MasterCard = 1, AmericanExpress = 2, Discover = 3 public static void Main() CreditCard mycard = CreditCard.Discover; Console.WriteLine(mycard); Console.WriteLine((int) mycard); C SHARP LAB MANUAL 6 5. Program to illustrate Arrays in C Sharp using System; public class UseArrays public static void Main()

7 String[] days_of_week = "Sunday", ; "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" foreach (string day in days_of_week) Console.WriteLine(day); C SHARP LAB MANUAL 7 6. Program to illustrate variables and constant Variables and Constants Simple value types can be assigned using the variable = value construct, whereas reference types are required to use the new keyword for creating a new instance. using System;

8 public class UseVariables public static void Main() const string HELLO_WORLD = "Hello World"; string message = HELLO_WORLD+ " in C#"; MyClass mc = new MyClass(message); mc.print(); public class MyClass private String message; public MyClass(String message) this.message = message; C SHARP LAB MANUAL 8 public void Print() Console.WriteLine(message);

9 C SHARP LAB MANUAL 9 7. Program to illustrate Expressions in C Sharp Expressions in C# are very similar to those provided by Java and C+ + programming languages. using System;

10 public class UseExpressions public static void Main() int a = 10; int b = 10; int result = a * b; bool check = (a == b); Console.WriteLine(result); Console.WriteLine(check); C SHARP LAB MANUAL Program to illustrate loops and statements in C Sharp As expected, the C# programming language includes several procedural programming constructs, including if-else, for loop, while loop, switch statements, and so on.

11 using System; public class UseStatements public static void Main() string[] message = "Hello", "World", "in", "C#"; foreach (string msg in message) Console.Write(msg+" "); Console.WriteLine(""); int a = 10; int b = 20; if (a < b) C SHARP LAB MANUAL 11 Console.WriteLine("a<b"); else Console.WriteLine("a>=b");

12 C SHARP LAB MANUAL Program to illustrate structures in C Sharp Structures are simply an aggregation of value types and are allocated on the stack and not on the heap. Structures are useful for passing a logical and related set of data values. Structures don't support inheritance but can implement interfaces. For instance, the following program would print Hitesh.Seth followed by John.Doe and illustrates that structures are not reference types.

13 using System; public class UseStructures public static void Main() Person hs = new Person("Hitesh","Seth"); Person jd = hs; jd.firstname = "John"; jd.lastname = "Doe"; Console.WriteLine(hs.FirstName+"."+hs.LastName); Console.WriteLine(jd.FirstName+"."+jd.LastName); C SHARP LAB MANUAL 13 public struct Person public string FirstName, LastName; public Person(string FirstName, string LastName)

14 this.lastname = LastName; this.firstname = FirstName; C SHARP LAB MANUAL Program to illustrate Class in C Sharp Classes, on the other hand, are reference types and hence are allocated on the heap. Classes provide object-oriented constructs such as encapsulation, polymorphism, and inheritance. For instance, the following program would print John.Doe twice, illustrating that objects are reference types, allocated on the heap.

15 using System; public class UseClasses public static void Main() Person hs = new Person("Hitesh","Seth"); Person jd = hs; jd.firstname = "John"; jd.lastname = "Doe"; Console.WriteLine(hs.GetFullName()); Console.WriteLine(jd.GetFullName()); C SHARP LAB MANUAL 15 public class Person private string sfirstname, slastname; public Person(string FirstName, string LastName)

16 this.sfirstname = FirstName; this.slastname = LastName; public string FirstName get set return sfirstname; sfirstname = value; public string LastName get C SHARP LAB MANUAL 16 return slastname; set

17 slastname = value; public String GetFullName() return this.firstname + "."+ this.lastname; C SHARP LAB MANUAL Program to illustrate Inheritance in Class in C Sharp Classes provide inheritance capability, which allows the derived class to inherit the functionality of a base class and potentially override some of the methods. A class definition consists of constructors and destructors, members, methods, properties, and events. (You will learn more about events later in this section.) Unlike the Java programming language, in

18 C# all methods that are overridden must be marked as virtual in the base class. The is operator provides runtime validation if an object is of a particular type. For instance, the following program will return that a FullPerson object is always a Person. using System; namespace hks public class UseInheritance public static void Main() FullPerson hs = new FullPerson("Hitesh","K","Seth"); Console.WriteLine(hs.GetFullName()); Object ohs = hs; if (ohs is Person) C SHARP LAB MANUAL 18 Console.WriteLine("I am still a Person"); public class Person

19 public string FirstName, LastName; public Person(string FirstName, string LastName) this.firstname = FirstName; this.lastname = LastName; public virtual string GetFullName() return this.firstname + "." + this.lastname; public class FullPerson : Person public string MiddleInitial; C SHARP LAB MANUAL 19 public FullPerson(string FirstName, string MiddleInitial, base(firstname,lastname) string LastName) : this.middleinitial = MiddleInitial;

20 public override string GetFullName() return this.firstname + "." + this.middleinitial + "." + this.lastname; C SHARP LAB MANUAL Program to illustrate abstract Class in C Sharp Classes can also be marked as either abstract, which means they have to be subclassed for any instances to be created, or sealed, which does not allow any subclassing. Using Abstract Classes (C#)

21 using System; public class UseAbstractClasses public static void Main() Person hs = new Person("Hitesh","Seth"); Console.WriteLine(hs.GetFullName()); abstract public class Abstract protected string FirstName, LastName; public Abstract(string FirstName, string LastName) this.firstname = FirstName; this.lastname = LastName; abstract public string GetFullName(); public class Person : Abstract

22 public Person(string FirstName, string LastName) : base(firstname, LastName) public override string GetFullName() return FirstName+"."+LastName; C SHARP LAB MANUAL Program to implement inheritance in C Sharp C# provides the concept of interfaces. Interfaces really represent a signature of what needs to be implemented by a derived class. C# supports multiple inheritances of interfaces using System;

23 public class UseInterfaces public static void Main() Person hs = new Person(); hs.name = "Hitesh Seth"; hs.address = "1 Executive Drive, City, NJ 08520"; Console.WriteLine(hs.GetName()); Console.WriteLine(hs.GetAddress()); public interface IName string GetName(); C SHARP LAB MANUAL 23 public interface IAddress string GetAddress(); public class Person : IName, IAddress private string name, address; public Person()

24 public string Name set name = value; public string Address set address = value; C SHARP LAB MANUAL 24 public string GetName() return name; public string GetAddress() return address;

25 C SHARP LAB MANUAL Program to illustrate exception handling in C Sharp C# provides robust exception handling capabilities. For instance, the program that follows catches the exception at runtime and allows messages to be displayed to the end user without requiring an intermediate exit. using System;

26 public class UseExceptions public static void Main() try int a = 10; int b = 10; int c = a/(a-b); catch (Exception ex) Console.WriteLine("Exception Caught"); Console.WriteLine(ex.Message); C SHARP LAB MANUAL 26

27 C SHARP LAB MANUAL Program to create custom exception handling in C Sharp Custom exceptions, which contain more information related to the underlying application, can also be created. Custom exceptions derive from the System.Exception class. Creating Custom Exceptions (C#) using System;

28 public class UseCustomExceptions public static void Main() try Discount big_discount = new Discount(56); catch (TooBigDiscountException ex) Console.WriteLine("Exception Caught"); Console.WriteLine(ex.Message); C SHARP LAB MANUAL 28 public class Discount private int percent; public Discount(int percent) this.percent = percent; if (percent > 50) throw new

29 TooBigDiscountException("Discount > 50%"); public class TooBigDiscountException : Exception public TooBigDiscountException(String msg) : base (msg) C SHARP LAB MANUAL Program to illustrate the use of delegates in C Sharp Delegates give C# programmers the capability of function pointers, basically passing a function as a parameter. using System; public class UseDelegates public delegate void MyDelegate(string message);

30 public static void Main() String message = "Hello Delegates"; MyDelegate d1 = new MyDelegate(PrintOnce); MyDelegate d2 = new MyDelegate(PrintTwice); d1(message); d2(message); public static void PrintOnce(String message) Console.WriteLine(message); C SHARP LAB MANUAL 30 public static void PrintTwice(String message) Console.WriteLine("1."+message); Console.WriteLine("2."+message);

31 C SHARP LAB MANUAL Program to illustrate the use of events in C Sharp A typical use of delegates is in event handling. For instance, take a look at Listing 3.5. It defines a class called Button, which has a Delegate called EventHandler. Event handlers can be assigned for the event OnClick and allow the calling application to pass in the reference of the method Button_Click as the callback method to invoke after the button is clicked. Using Events (C#) using System; public class Events public static void Main()

32 Button button = new Button(); button.onclick+= new Button.EventHandler(Button_Click) ; button.click(); public static void Button_Click() Console.WriteLine("Button Clicked"); C SHARP LAB MANUAL 31 public class Button public delegate void EventHandler(); public event EventHandler OnClick; public void Click() OnClick();

33

Introduction to.net, C#, and Visual Studio. Part I. Administrivia. Administrivia. Course Structure. Final Project. Part II. What is.net?

Introduction to.net, C#, and Visual Studio. Part I. Administrivia. Administrivia. Course Structure. Final Project. Part II. What is.net? Introduction to.net, C#, and Visual Studio C# Programming Part I Administrivia January 8 Administrivia Course Structure When: Wednesdays 10 11am (and a few Mondays as needed) Where: Moore 100B This lab

More information

Introduce C# as Object Oriented programming language. Explain, tokens,

Introduce C# as Object Oriented programming language. Explain, tokens, Module 2 98 Assignment 1 Introduce C# as Object Oriented programming language. Explain, tokens, lexicals and control flow constructs. 99 The C# Family Tree C Platform Independence C++ Object Orientation

More information

DAD Lab. 1 Introduc7on to C#

DAD Lab. 1 Introduc7on to C# DAD 2017-18 Lab. 1 Introduc7on to C# Summary 1..NET Framework Architecture 2. C# Language Syntax C# vs. Java vs C++ 3. IDE: MS Visual Studio Tools Console and WinForm Applica7ons 1..NET Framework Introduc7on

More information

C#: framework overview and in-the-small features

C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer C#: framework overview and in-the-small features Chair of Software Engineering Carlo A. Furia, Marco Piccioni, Bertrand Meyer

More information

3. Basic Concepts. 3.1 Application Startup

3. Basic Concepts. 3.1 Application Startup 3.1 Application Startup An assembly that has an entry point is called an application. When an application runs, a new application domain is created. Several different instantiations of an application may

More information

C# Java. C# Types Naming Conventions. Distribution and Integration Technologies. C# C++.NET A C# program is a collection of: C C++ C# Language

C# Java. C# Types Naming Conventions. Distribution and Integration Technologies. C# C++.NET A C# program is a collection of: C C++ C# Language C# Java Distribution and Integration Technologies C# Language C C++ C# C++.NET A C# program is a collection of: Classes Structs Interfaces Delegates Enums (can be grouped in namespaces) One entry point

More information

Distribution and Integration Technologies. C# Language

Distribution and Integration Technologies. C# Language Distribution and Integration Technologies C# Language Classes Structs Interfaces Delegates Enums C# Java C C++ C# C++.NET A C# program is a collection of: (can be grouped in namespaces) One entry point

More information

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class.

Hierarchical inheritance: Contains one base class and multiple derived classes of the same base class. 1. What is C#? C# (pronounced "C sharp") is a simple, modern, object oriented, and type safe programming language. It will immediately be familiar to C and C++ programmers. C# combines the high productivity

More information

Introduction To C#.NET

Introduction To C#.NET Introduction To C#.NET Microsoft.Net was formerly known as Next Generation Windows Services(NGWS).It is a completely new platform for developing the next generation of windows/web applications. However

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming 1. What is object-oriented programming (OOP)? OOP is a technique to develop logical modules, such as classes that contain properties, methods, fields, and events. An object

More information

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations

C#.Net. Course Contents. Course contents VT BizTalk. No exam, but laborations , 1 C#.Net VT 2009 Course Contents C# 6 hp approx. BizTalk 1,5 hp approx. No exam, but laborations Course contents Architecture Visual Studio Syntax Classes Forms Class Libraries Inheritance Other C# essentials

More information

Chapter 1 Getting Started

Chapter 1 Getting Started Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different

More information

IT 528 Developing.NET Applications Using C# Gülşen Demiröz

IT 528 Developing.NET Applications Using C# Gülşen Demiröz IT 528 Developing.NET Applications Using C# Gülşen Demiröz Summary of the Course Hands-on applications programming course We will learn how to develop applications using the C# programming language on

More information

This tutorial has been prepared for the beginners to help them understand basics of c# Programming.

This tutorial has been prepared for the beginners to help them understand basics of c# Programming. About thetutorial C# is a simple, modern, general-purpose, object-oriented programming language developed by Microsoft within its.net initiative led by Anders Hejlsberg. This tutorial covers basic C# programming

More information

C++\CLI. Jim Fawcett CSE687-OnLine Object Oriented Design Summer 2017

C++\CLI. Jim Fawcett CSE687-OnLine Object Oriented Design Summer 2017 C++\CLI Jim Fawcett CSE687-OnLine Object Oriented Design Summer 2017 Comparison of Object Models Standard C++ Object Model All objects share a rich memory model: Static, stack, and heap Rich object life-time

More information

Introduction to C# Applications

Introduction to C# Applications 1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making

More information

EEE-425 Programming Languages (2013) 1

EEE-425 Programming Languages (2013) 1 2 Namespaces Classes Fields Properties Methods Attributes Events Interfaces (contracts) Methods Properties Events Control Statements if, else, while, for, switch foreach Additional Features Operation Overloading

More information

What property of a C# array indicates its allocated size? What keyword in the base class allows a method to be polymorphic?

What property of a C# array indicates its allocated size? What keyword in the base class allows a method to be polymorphic? What property of a C# array indicates its allocated size? a. Size b. Count c. Length What property of a C# array indicates its allocated size? a. Size b. Count c. Length What keyword in the base class

More information

.Net Technologies. Components of.net Framework

.Net Technologies. Components of.net Framework .Net Technologies Components of.net Framework There are many articles are available in the web on this topic; I just want to add one more article over the web by explaining Components of.net Framework.

More information

Cloning Enums. Cloning and Enums BIU OOP

Cloning Enums. Cloning and Enums BIU OOP Table of contents 1 Cloning 2 Integer representation Object representation Java Enum Cloning Objective We have an object and we need to make a copy of it. We need to choose if we want a shallow copy or

More information

UNIT I An overview of Programming models Programmers Perspective

UNIT I An overview of Programming models Programmers Perspective UNIT I An overview of Programming models Programmers Perspective 1. C/Win32 API Programmer It is complex C is short/abrupt language Manual Memory Management, Ugly Pointer arithmetic, ugly syntactic constructs

More information

Computing is about Data Processing (or "number crunching") Object Oriented Programming is about Cooperating Objects

Computing is about Data Processing (or number crunching) Object Oriented Programming is about Cooperating Objects Computing is about Data Processing (or "number crunching") Object Oriented Programming is about Cooperating Objects C# is fully object-oriented: Everything is an Object: Simple Types, User-Defined Types,

More information

Saikat Banerjee Page 1

Saikat Banerjee Page 1 1. What s the advantage of using System.Text.StringBuilder over System.String? StringBuilder is more efficient in the cases, where a lot of manipulation is done to the text. Strings are immutable, so each

More information

Objectives. Describe ways to create constants const readonly enum

Objectives. Describe ways to create constants const readonly enum Constants Objectives Describe ways to create constants const readonly enum 2 Motivation Idea of constant is useful makes programs more readable allows more compile time error checking 3 Const Keyword const

More information

Inheritance and Polymorphism

Inheritance and Polymorphism Object Oriented Programming Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. Al-Azhar University Website: eaymanelshenawy.wordpress.com Email : eaymanelshenawy@azhar.edu.eg

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

A Comparison of Visual Basic.NET and C#

A Comparison of Visual Basic.NET and C# Appendix B A Comparison of Visual Basic.NET and C# A NUMBER OF LANGUAGES work with the.net Framework. Microsoft is releasing the following four languages with its Visual Studio.NET product: C#, Visual

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

SWE344. Internet Protocols and Client-Server Programming

SWE344. Internet Protocols and Client-Server Programming SWE344 Internet Protocols and Client-Server Programming Module 1a: 1a: Introduction Dr. El-Sayed El-Alfy Mr. Bashir M. Ghandi alfy@kfupm.edu.sa bmghandi@ccse.kfupm.edu.sa Computer Science Department King

More information

C# Types. Industrial Programming. Value Types. Signed and Unsigned. Lecture 3: C# Fundamentals

C# Types. Industrial Programming. Value Types. Signed and Unsigned. Lecture 3: C# Fundamentals C# Types Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:

More information

Visual Studio.NET.NET Framework. Web Services Web Forms Windows Forms. Data and XML classes. Framework Base Classes. Common Language Runtime

Visual Studio.NET.NET Framework. Web Services Web Forms Windows Forms. Data and XML classes. Framework Base Classes. Common Language Runtime Intro C# Intro C# 1 Microsoft's.NET platform and Framework.NET Enterprise Servers Visual Studio.NET.NET Framework.NET Building Block Services Operating system on servers, desktop, and devices Web Services

More information

Industrial Programming

Industrial Programming Industrial Programming Lecture 3: C# Fundamentals Industrial Programming 1 C# Types Industrial Programming 2 Value Types Memory location contains the data. Integers: Signed: sbyte, int, short, long Unsigned:

More information

C# in Unity 101. Objects perform operations when receiving a request/message from a client

C# in Unity 101. Objects perform operations when receiving a request/message from a client C# in Unity 101 OOP What is OOP? Objects perform operations when receiving a request/message from a client Requests are the ONLY* way to get an object to execute an operation or change the object s internal

More information

Agenda: Discussion Week 7. May 11, 2009

Agenda: Discussion Week 7. May 11, 2009 Agenda: Discussion Week 7 Method signatures Static vs. instance compareto Exceptions Interfaces 2 D arrays Recursion varargs enum Suggestions? May 11, 2009 Method signatures [protection] [static] [return

More information

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am

CMSC 202 Section 010x Spring Justin Martineau, Tuesday 11:30am CMSC 202 Section 010x Spring 2007 Computer Science II Final Exam Name: Username: Score Max Section: (check one) 0101 - Justin Martineau, Tuesday 11:30am 0102 - Sandeep Balijepalli, Thursday 11:30am 0103

More information

CIS 110: Introduction to Computer Programming

CIS 110: Introduction to Computer Programming CIS 110: Introduction to Computer Programming Lecture 22 and 23 Objects, objects, objects ( 8.1-8.4) 11/28/2011 CIS 110 (11fa) - University of Pennsylvania 1 Outline Object-oriented programming. What is

More information

Outline. CIS 110: Introduction to Computer Programming. Any questions? My life story. A horrible incident. The awful truth

Outline. CIS 110: Introduction to Computer Programming. Any questions? My life story. A horrible incident. The awful truth Outline CIS 110: Introduction to Computer Programming Lecture 22 and 23 Objects, objects, objects ( 8.1-8.4) Object-oriented programming. What is an object? Classes as blueprints for objects. Encapsulation

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 02: Using Objects MOUNA KACEM mouna@cs.wisc.edu Fall 2018 Using Objects 2 Introduction to Object Oriented Programming Paradigm Objects and References Memory Management

More information

Getting started 7. Storing values 21. Creating variables 22 Reading input 24 Employing arrays 26 Casting data types 28 Fixing constants 30 Summary 32

Getting started 7. Storing values 21. Creating variables 22 Reading input 24 Employing arrays 26 Casting data types 28 Fixing constants 30 Summary 32 Contents 1 2 3 Contents Getting started 7 Introducing C# 8 Installing Visual Studio 10 Exploring the IDE 12 Starting a Console project 14 Writing your first program 16 Following the rules 18 Summary 20

More information

PES INSTITUTE OF TECHNOLOGY

PES INSTITUTE OF TECHNOLOGY Seventh Semester B.E. IA Test-I, 2014 USN 1 P E I S PES INSTITUTE OF TECHNOLOGY C# solution set for T1 Answer any 5 of the Following Questions 1) What is.net? With a neat diagram explain the important

More information

2. A GUI A. uses buttons, menus, and icons B. should be easy for a user to manipulate C. both (a) and (b) D. stands for Graphic Use Interaction

2. A GUI A. uses buttons, menus, and icons B. should be easy for a user to manipulate C. both (a) and (b) D. stands for Graphic Use Interaction 1. Which language is not a true object-oriented programming language? A. VB 6 B. VB.NET C. JAVA D. C++ 2. A GUI A. uses buttons, menus, and icons B. should be easy for a user to manipulate C. both (a)

More information

CLASSES AND OBJECTS IN JAVA

CLASSES AND OBJECTS IN JAVA Lesson 8 CLASSES AND OBJECTS IN JAVA (1) Which of the following defines attributes and methods? (a) Class (b) Object (c) Function (d) Variable (2) Which of the following keyword is used to declare Class

More information

C# Frequently Asked Questions for C++ programmers

C# Frequently Asked Questions for C++ programmers Page 1 of 16 C# Frequently Asked Questions for C++ programmers Andy McMullan Last update: 3-Dec-2000 This FAQ tries to address many of the basic questions that C++ developers have when they first come

More information

EXAM Microsoft MTA Software Development Fundamentals. Buy Full Product.

EXAM Microsoft MTA Software Development Fundamentals. Buy Full Product. Microsoft EXAM - 98-361 Microsoft MTA Software Development Fundamentals Buy Full Product http://www.examskey.com/98-361.html Examskey Microsoft 98-361 exam demo product is here for you to test the quality

More information

POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors

POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors CSC 330 OO Software Design 1 Abstract Base Classes class B { // base class virtual void m( ) =0; // pure virtual

More information

POLYMORPHISM 2 PART. Shared Interface. Discussions. Abstract Base Classes. Abstract Base Classes and Pure Virtual Methods EXAMPLE

POLYMORPHISM 2 PART. Shared Interface. Discussions. Abstract Base Classes. Abstract Base Classes and Pure Virtual Methods EXAMPLE Abstract Base Classes POLYMORPHISM 2 PART Abstract Classes Static and Dynamic Casting Common Programming Errors class B { // base class virtual void m( ) =0; // pure virtual function class D1 : public

More information

Framework Fundamentals

Framework Fundamentals Questions Framework Fundamentals 1. Which of the following are value types? (Choose all that apply.) A. Decimal B. String C. System.Drawing.Point D. Integer 2. Which is the correct declaration for a nullable

More information

Extending Classes (contd.) (Chapter 15) Questions:

Extending Classes (contd.) (Chapter 15) Questions: Extending Classes (contd.) (Chapter 15) Questions: 1 Virtual Functions in C++ Employee /\ / \ ---- Manager 2 Case 1: class Employee { string firstname, lastname; //... Employee( string fnam, string lnam

More information

PES INSTITUTE OF TECHNOLOGY (BSC) V MCA, Second IA Test, OCTOBER 2017 Programming Using C#.NET (13MCA53) Solution Set Faculty: Jeny Jijo

PES INSTITUTE OF TECHNOLOGY (BSC) V MCA, Second IA Test, OCTOBER 2017 Programming Using C#.NET (13MCA53) Solution Set Faculty: Jeny Jijo PES INSTITUTE OF TECHNOLOGY (BSC) V MCA, Second IA Test, OCTOBER 2017 Programming Using C#.NET (13MCA53) Solution Set Faculty: Jeny Jijo 1. What is Encapsulation? Explain the two ways of enforcing encapsulation

More information

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe

OBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++

More information

DigiPen Institute of Technology

DigiPen Institute of Technology DigiPen Institute of Technology Presents Session Two: Overview of C# Programming DigiPen Institute of Technology 5001 150th Ave NE, Redmond, WA 98052 Phone: (425) 558-0299 www.digipen.edu 2005 DigiPen

More information

6.096 Introduction to C++ January (IAP) 2009

6.096 Introduction to C++ January (IAP) 2009 MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture

More information

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout 1 Last update: 2 November 2004 Trusted Components Reuse, Contracts and Patterns Prof. Dr. Bertrand Meyer Dr. Karine Arnout 2 Lecture 26: Component model: The.NET example Agenda for today 3 What is.net?

More information

DAD Lab. 2 Additional C# Topics

DAD Lab. 2 Additional C# Topics DAD 2017-2018 Lab. 2 Additional C# Topics Summary 1. Properties 2. Exceptions 3. Delegates and events 4. Generics 5. Threads and synchronization 1. Properties Get/Set Properties Simple way to control the

More information

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain

Duhok Polytechnic University Amedi Technical Institute/ IT Dept. Halkawt Rajab Hussain Duhok Polytechnic University Amedi Technical Institute/ IT Dept. By Halkawt Rajab Hussain 2016-04-02 Overview. C# program structure. Variables and Constant. Conditional statement (if, if/else, nested if

More information

Module 6: Fundamentals of Object- Oriented Programming

Module 6: Fundamentals of Object- Oriented Programming Module 6: Fundamentals of Object- Oriented Programming Table of Contents Module Overview 6-1 Lesson 1: Introduction to Object-Oriented Programming 6-2 Lesson 2: Defining a Class 6-10 Lesson 3: Creating

More information

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson

Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Zhifu Pei CSCI5448 Spring 2011 Prof. Kenneth M. Anderson Introduction History, Characteristics of Java language Java Language Basics Data types, Variables, Operators and Expressions Anatomy of a Java Program

More information

JaCIL: A CLI to JVM Compiler Technical Report. Almann T. Goo Rochester Institute of Technology Department of Computer Science

JaCIL: A CLI to JVM Compiler Technical Report. Almann T. Goo Rochester Institute of Technology Department of Computer Science JaCIL: A CLI to JVM Compiler Technical Report Almann T. Goo atg2335@cs.rit.edu Rochester Institute of Technology Department of Computer Science July 25, 2006 Abstract Both the.net Framework via the Common

More information

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity.

OOPS Viva Questions. Object is termed as an instance of a class, and it has its own state, behavior and identity. OOPS Viva Questions 1. What is OOPS? OOPS is abbreviated as Object Oriented Programming system in which programs are considered as a collection of objects. Each object is nothing but an instance of a class.

More information

CS3157: Advanced Programming. Outline

CS3157: Advanced Programming. Outline CS3157: Advanced Programming Lecture #12 Apr 3 Shlomo Hershkop shlomo@cs.columbia.edu 1 Outline Intro CPP Boring stuff: Language basics: identifiers, data types, operators, type conversions, branching

More information

C#, Visual Basic, C++/CLI, and F#

C#, Visual Basic, C++/CLI, and F# 53 C#, Visual Basic, C++/CLI, and F# WHAT S IN THIS CHAPTER? Namespaces Defi ning types Methods Arrays Control statements Loops Exception handling Inheritance Resource management Delegates Events Generics

More information

Chapter 5 Object-Oriented Programming

Chapter 5 Object-Oriented Programming Chapter 5 Object-Oriented Programming Develop code that implements tight encapsulation, loose coupling, and high cohesion Develop code that demonstrates the use of polymorphism Develop code that declares

More information

Modern Programming Languages. Lecture Java Programming Language. An Introduction

Modern Programming Languages. Lecture Java Programming Language. An Introduction Modern Programming Languages Lecture 27-30 Java Programming Language An Introduction 107 Java was developed at Sun in the early 1990s and is based on C++. It looks very similar to C++ but it is significantly

More information

Developing Microsoft.NET Applications for Windows (Visual Basic.NET)

Developing Microsoft.NET Applications for Windows (Visual Basic.NET) Developing Microsoft.NET Applications for Windows (Visual Basic.NET) Course Number: 2555 Length: 1 Day(s) Certification Exam This course will help you prepare for the following Microsoft Certified Professional

More information

12/14/2016. Errors. Debugging and Error Handling. Run-Time Errors. Debugging in C# Debugging in C# (continued)

12/14/2016. Errors. Debugging and Error Handling. Run-Time Errors. Debugging in C# Debugging in C# (continued) Debugging and Error Handling Debugging methods available in the ID Error-handling techniques available in C# Errors Visual Studio IDE reports errors as soon as it is able to detect a problem Error message

More information

C# Language Object-oriented Programming Basics

C# Language Object-oriented Programming Basics C# Language Object-oriented Programming Basics O 2 DES.NET Object-oriented Simulation and Optimization Algorithm (1) 2017 Li Haobin, ISEM Department,NUS 1 Syllabus 1. C# Language Object-oriented Programming

More information

Table of Contents Preface Bare Necessities... 17

Table of Contents Preface Bare Necessities... 17 Table of Contents Preface... 13 What this book is about?... 13 Who is this book for?... 14 What to read next?... 14 Personages... 14 Style conventions... 15 More information... 15 Bare Necessities... 17

More information

Understand Computer Storage and Data Types

Understand Computer Storage and Data Types Understand Computer Storage and Data Types Lesson Overview Students will understand computer storage and data types. In this lesson, you will learn: How a computer stores programs and instructions in computer

More information

LEARN WITH INTRODUCTION TO TYPESCRIPT

LEARN WITH INTRODUCTION TO TYPESCRIPT LEARN WITH INTRODUCTION TO TYPESCRIPT By Jeffry Houser http://www.learn-with.com http://www.jeffryhouser.com https://www.dot-com-it.com Copyright 2017 by DotComIt, LLC Contents Title Page... 2 Introduction

More information

DC69 C# &.NET JUNE C# is a simple, modern, object oriented language derived from C++ and Java.

DC69 C# &.NET JUNE C# is a simple, modern, object oriented language derived from C++ and Java. Q.2 a. What is C#? Discuss its features in brief. 1. C# is a simple, modern, object oriented language derived from C++ and Java. 2. It aims to combine the high productivity of Visual Basic and the raw

More information

PES INSTITUTE OF TECHNOLOGY (BSC) V MCA, Second IA Test, September 2014

PES INSTITUTE OF TECHNOLOGY (BSC) V MCA, Second IA Test, September 2014 PES INSTITUTE OF TECHNOLOGY (BSC) V MCA, Second IA Test, September 2014 Topics in Enterprise Architectures-II Solution Set Faculty: Jeny Jijo 1) What is Encapsulation? Explain the two ways of enforcing

More information

Brief Summary of Java

Brief Summary of Java Brief Summary of Java Java programs are compiled into an intermediate format, known as bytecode, and then run through an interpreter that executes in a Java Virtual Machine (JVM). The basic syntax of Java

More information

CE221 Programming in C++ Part 1 Introduction

CE221 Programming in C++ Part 1 Introduction CE221 Programming in C++ Part 1 Introduction 06/10/2017 CE221 Part 1 1 Module Schedule There are two lectures (Monday 13.00-13.50 and Tuesday 11.00-11.50) each week in the autumn term, and a 2-hour lab

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Advanced Object-Oriented Programming. 11 Features. C# Programming: From Problem Analysis to Program Design. 4th Edition

Advanced Object-Oriented Programming. 11 Features. C# Programming: From Problem Analysis to Program Design. 4th Edition 11 Features Advanced Object-Oriented Programming C# Programming: From Problem Analysis to Program Design C# Programming: From Problem Analysis to Program Design 1 4th Edition Chapter Objectives Learn the

More information

CGS 2405 Advanced Programming with C++ Course Justification

CGS 2405 Advanced Programming with C++ Course Justification Course Justification This course is the second C++ computer programming course in the Computer Science Associate in Arts degree program. This course is required for an Associate in Arts Computer Science

More information

Functional programming in C#

Functional programming in C# Functional programming in C# A quick approach to another paradigm Nacho Iborra IES San Vicente This work is licensed under the Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License.

More information

EL2310 Scientific Programming

EL2310 Scientific Programming (pronobis@kth.se) Overview Overview Wrap Up Introduction to Object Oriented Paradigm More on and Members Operator Overloading Last time Intro to C++ Differences between C and C++ Intro to OOP Today Object

More information

COP 3330 Final Exam Review

COP 3330 Final Exam Review COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

CS105 C++ Lecture 7. More on Classes, Inheritance

CS105 C++ Lecture 7. More on Classes, Inheritance CS105 C++ Lecture 7 More on Classes, Inheritance " Operator Overloading Global vs Member Functions Difference: member functions already have this as an argument implicitly, global has to take another parameter.

More information

CS349/SE382 A1 C Programming Tutorial

CS349/SE382 A1 C Programming Tutorial CS349/SE382 A1 C Programming Tutorial Erin Lester January 2005 Outline Comments Variable Declarations Objects Dynamic Memory Boolean Type structs, enums and unions Other Differences The Event Loop Comments

More information

JAVA OBJECT-ORIENTED PROGRAMMING

JAVA OBJECT-ORIENTED PROGRAMMING SE2205B - DATA STRUCTURES AND ALGORITHMS JAVA OBJECT-ORIENTED PROGRAMMING Kevin Brightwell Thursday January 12th, 2017 Acknowledgements:Dr. Quazi Rahman 1 / 36 LECTURE OUTLINE Composition Inheritance The

More information

Object-Oriented Programming in C# (VS 2015)

Object-Oriented Programming in C# (VS 2015) Object-Oriented Programming in C# (VS 2015) This thorough and comprehensive 5-day course is a practical introduction to programming in C#, utilizing the services provided by.net. This course emphasizes

More information

Object Oriented Programming CS250

Object Oriented Programming CS250 Object Oriented Programming CS250 Abas Computer Science Dept, Faculty of Computers & Informatics, Zagazig University arabas@zu.edu.eg http://www.arsaliem.faculty.zu.edu.eg Polymorphism Chapter 8 8.1 Static

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 6 : Abstraction Lecture Contents 2 Abstract classes Abstract methods Case study: Polymorphic processing Sealed methods & classes

More information

Java Object Oriented Design. CSC207 Fall 2014

Java Object Oriented Design. CSC207 Fall 2014 Java Object Oriented Design CSC207 Fall 2014 Design Problem Design an application where the user can draw different shapes Lines Circles Rectangles Just high level design, don t write any detailed code

More information

COPYRIGHTED MATERIAL. Visual Basic 2008 Core Elements

COPYRIGHTED MATERIAL. Visual Basic 2008 Core Elements Evjen-91361 c01.tex V2-04/01/2008 3:17pm Page 1 Visual Basic 2008 Core Elements This chapter introduces the core elements that make up Visual Basic 2008. Every software development language has unique

More information

EVALUATION COPY. Unauthorized reproduction or distribution is prohibitied C# ESSENTIALS

EVALUATION COPY. Unauthorized reproduction or distribution is prohibitied C# ESSENTIALS C# ESSENTIALS C# Essentials Rev. 4.8 Student Guide Information in this document is subject to change without notice. Companies, names and data used in examples herein are fictitious unless otherwise noted.

More information

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio

COPYRIGHTED MATERIAL. Contents. Part I: C# Fundamentals 1. Chapter 1: The.NET Framework 3. Chapter 2: Getting Started with Visual Studio Introduction XXV Part I: C# Fundamentals 1 Chapter 1: The.NET Framework 3 What s the.net Framework? 3 Common Language Runtime 3.NET Framework Class Library 4 Assemblies and the Microsoft Intermediate Language

More information

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University

Lecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types

More information

04-24/26 Discussion Notes

04-24/26 Discussion Notes 04-24/26 Discussion Notes PIC 10B Spring 2018 1 When const references should be used and should not be used 1.1 Parameters to constructors We ve already seen code like the following 1 int add10 ( int x

More information

Inheritance, and Polymorphism.

Inheritance, and Polymorphism. Inheritance and Polymorphism by Yukong Zhang Object-oriented programming languages are the most widely used modern programming languages. They model programming based on objects which are very close to

More information

IST311. Advanced Issues in OOP: Inheritance and Polymorphism

IST311. Advanced Issues in OOP: Inheritance and Polymorphism IST311 Advanced Issues in OOP: Inheritance and Polymorphism IST311/602 Cleveland State University Prof. Victor Matos Adapted from: Introduction to Java Programming: Comprehensive Version, Eighth Edition

More information

Programming II (CS300)

Programming II (CS300) 1 Programming II (CS300) Chapter 02: Using Objects MOUNA KACEM mouna@cs.wisc.edu Spring 2018 Using Objects 2 Introduction to Object Oriented Programming Paradigm Objects and References Memory Management

More information

EAServer 6.1 New Features Guide

EAServer 6.1 New Features Guide EAServer 6.1 New Features Guide Document ID: DC38032-01-0610-01 Last revised: December 2007 Topic Page.NET client support 1 Management Console Eclipse plug-in 10 Single sign-on and SiteMinder support 10

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

VISUAL PROGRAMMING_IT0309 Semester Number 05. G.Sujatha & R.Vijayalakshmi Assistant professor(o.g) SRM University, Kattankulathur

VISUAL PROGRAMMING_IT0309 Semester Number 05. G.Sujatha & R.Vijayalakshmi Assistant professor(o.g) SRM University, Kattankulathur School of Computing, 12/26/2012 1 VISUAL PROGRAMMING_IT0309 Semester Number 05 G.Sujatha & R.Vijayalakshmi Assistant professor(o.g) SRM University, Kattankulathur UNIT 1 School of Computing, Department

More information

OBJECT ORIENTED PROGRAMMING

OBJECT ORIENTED PROGRAMMING OBJECT ORIENTED PROGRAMMING OBJECT ORIENTED PROGRAMMING Design principles for organizing code into user-defined types Principles include: Encapsulation Inheritance Polymorphism http://en.wikipedia.org/wiki/encapsulation_(object-oriented_programming)

More information

CPSC 427: Object-Oriented Programming

CPSC 427: Object-Oriented Programming CPSC 427: Object-Oriented Programming Michael J. Fischer Lecture 19 November 7, 2018 CPSC 427, Lecture 19, November 7, 2018 1/18 Exceptions Thowing an Exception Catching an Exception CPSC 427, Lecture

More information