About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.

Slides:



Advertisements
Similar presentations
The Web Warrior Guide to Web Design Technologies
Advertisements

 2005 Pearson Education, Inc. All rights reserved Introduction.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Chapter 1: Introduction
Introduction To Computers and Programming Lecture 2: Your first program Professor: Evan Korth New York University.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
 2003 Prentice Hall, Inc. All rights reserved. Customized by Sana Odeh for the use of this class. 1 Introduction to Computers and Programming in JAVA.
Using the Visual Basic Editor Visual Basic for Applications 1.
Introduction to Computing and Programming
C# Programming: From Problem Analysis to Program Design1 2 Your First C# Program.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
Chapter 13: Object-Oriented Programming
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
1 An Introduction to Visual Basic Objectives Explain the history of programming languages Define the terminology used in object-oriented programming.
INTRODUCTION TO JAVA PROGRAMMING Chapter 1. What is Computer Programming?
1. 2 Chapter 1 Introduction to Computers, Programs, and Java.
Creating a Console Application with Visual Studio
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter One An Introduction to Visual Basic 2010.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
Your Interactive Guide to the Digital World Discovering Computers 2012.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
A First Program Using C#
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
Topics Introduction Hardware and Software How Computers Store Data
Microsoft Visual Basic 2005: Reloaded Second Edition
Chapter 1: Creating Java Programs
An Object-Oriented Approach to Programming Logic and Design
Teacher: Ms. Olifer MICROSOFT VISUAL STUDIO 2010: PROPERTIES OF WINDOWS FORM OBJECT.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Computing with C# and the.NET Framework Chapter 1 An Introduction to Computing with C# ©2003, 2011 Art Gittleman.
Chapter 3: Completing the Problem- Solving Process and Getting Started with C++ Introduction to Programming with C++ Fourth Edition.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Programming With C.
Intro and Review Welcome to Java. Introduction Java application programming Use tools from the JDK to compile and run programs. Videos at
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Chapter One An Introduction to Visual Basic 2010 Programming with Microsoft Visual Basic th Edition.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
1 Chapter Eleven Handling Events. 2 Objectives Learn about delegates How to create composed delegates How to handle events How to use the built-in EventHandler.
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
 Pearson Education, Inc. All rights reserved Introduction to Java Applications.
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
Chapter Three The UNIX Editors.
1.
Creating a Java Application and Applet
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
Programming Logic and Design Fourth Edition, Comprehensive Chapter 14 Event-Driven Programming with Graphical User Interfaces.
Microsoft Visual C# 2010 Fourth Edition Chapter 3 Using GUI Objects and the Visual Studio IDE.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
CHAPTER 3 COMPLETING THE PROBLEM- SOLVING PROCESS AND GETTING STARTED WITH C++ An Introduction to Programming with C++ Fifth Edition.
Java Programming Fifth Edition Chapter 1 Creating Your First Java Classes.
Chapter 2 Build Your First Project A Step-by-Step Approach 2 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
IS 350 Course Introduction. Slide 2 Objectives Identify the steps performed in the software development life cycle Describe selected tools used to design.
CSC201: Computer Programming
Topics Introduction Hardware and Software How Computers Store Data
Chapter 1: An Introduction to Visual Basic 2015
C# and the .NET Framework
About the Presentations
Microsoft Office Illustrated
C# Programming: From Problem Analysis to Program Design
CIS16 Application Development Programming with Visual Basic
Topics Introduction Hardware and Software How Computers Store Data
Computer Programming-1 CSC 111
Programming Logic and Design Eighth Edition
Presentation transcript:

About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning of each presentation. You may customize the presentations to fit your class needs. Some figures from the chapters are included. A complete set of images from the book can be found on the Instructor Resources disc. 1

Microsoft Visual C# 2010 Fourth Edition Chapter 1 A First Program Using C#

Microsoft Visual C# 2010, Fourth Edition3 Objectives Learn about programming Learn about procedural and object-oriented programming Learn about the features of object-oriented programming languages Learn about the C# programming language Write a C# program that produces output Learn how to select identifiers to use within your programs

Microsoft Visual C# 2010, Fourth Edition4 Objectives (cont'd.) Improve programs by adding comments and using the System namespace Write and compile a C# program using the command prompt and using Visual Studio

Programming Computer program –Set of instructions that tells a computer what to do –Also called software Software comes in two broad categories –System software –Application software Machine language –Expressed as a series of 1s and 0s 1s represent switches that are on, and 0s represent switches that are off Microsoft Visual C# 2010, Fourth Edition5

Programming (cont'd.) High-level programming languages –Use reasonable terms such as “read,” “write,” or “add” Instead of the sequence of on/off switches that perform these tasks –Allows you to assign reasonable names to areas of computer memory –Has its own syntax (rules of the language) Compiler –Translates high-level language statements into machine code Microsoft Visual C# 2010, Fourth Edition6

Programming (cont'd.) Programming logic –Involves executing the various statements and procedures in the correct order To produce the desired results Debugging –Process of removing all syntax and logical errors from the program Microsoft Visual C# 2010, Fourth Edition7

Procedural and Object-Oriented Programming Procedural program –Create and name computer memory locations that can hold values (variables) –Write a series of steps or operations to manipulate those values Identifier –A one-word name used to reference a variable Procedures or methods –Logical units that group individual operations used in a computer program –Called or invoked by other procedures or methods Microsoft Visual C# 2010, Fourth Edition8

Procedural and Object-Oriented Programming (cont'd.) Object-oriented programming –An extension of procedural programming Objects –Similar to concrete objects in the real world –Contain their own variables and methods –Attributes of an object represent its characteristics –State of an object is the collective value of all its attributes at any point in time –Behaviors of an object are the things it “does” Microsoft Visual C# 2010, Fourth Edition9

Procedural and Object-Oriented Programming (cont'd.) Originally used for two types of applications –Computer simulations –Graphical user interfaces (GUIs)

Features of Object-Oriented Programming Languages Classes –A category of objects or a type of object –Describes the attributes and methods of every object that is an instance, or example, of that class Objects –An instance of a class Encapsulation –Technique of packaging an object’s attributes and methods into a cohesive unit; undivided entity –Using a black box Microsoft Visual C# 2010, Fourth Edition11

Features of Object-Oriented Programming Languages (cont'd.) Interface –Interaction between a method and an object Inheritance –Provides the ability to extend a class to create a more specific class Polymorphism –Describes the ability to create methods that act appropriately depending on the context Microsoft Visual C# 2010, Fourth Edition12

The C# Programming Language Developed as an object-oriented and component- oriented language Part of Microsoft Visual Studio 2010 Allows every piece of data to be treated as an object and to consistently employ the principles of object-oriented programming Contains a GUI interface that makes it similar to Visual Basic Microsoft Visual C# 2010, Fourth Edition13

Microsoft Visual C# 2010, Fourth Edition14 The C# Programming Language (cont'd.) Modeled after the C++ programming language –However, eliminates some of the most difficult features to understand in C++ Very similar to Java –In C#, simple data types are objects

Writing a C# Program that Produces Output Microsoft Visual C# 2010, Fourth Edition15 literal string argument method class namespace

Writing a C# Program that Produces Output (cont'd.) Namespace –Provides a way to group similar classes C# method parts –Method header Includes the method name and information about what will pass into and be returned from a method –Method body Contained within a pair of curly braces and includes all the instructions executed by the method Microsoft Visual C# 2010, Fourth Edition16

Writing a C# Program that Produces Output (cont'd.) Whitespace –Any combination of spaces, tabs, and carriage returns (blank lines) –Organizes your code and makes it easier to read Access modifier –Defines the circumstances under which the method can be accessed Keywords –Predefined and reserved identifiers that have special meaning to the compiler Microsoft Visual C# 2010, Fourth Edition17

Microsoft Visual C# 2010, Fourth Edition Writing a C# Program that Produces Output (cont'd.) The name of the method is Main() –Every application must have a Main() method –Classes with a Main() method are called application classes; others are non-application classes The method returns nothing as indicated by the keyword void

Selecting Identifiers Requirements –Must begin with an underscore, at sign or letter Letters include foreign-alphabet letters –Can contain only letters, digits, underscores, and the at sign Not special characters such as #, $, or & –Cannot be a C# reserved keyword Microsoft Visual C# 2010, Fourth Edition19

Microsoft Visual C# 2010, Fourth Edition20

Microsoft Visual C# 2010, Fourth Edition21 Selecting Identifiers (cont'd.)

Microsoft Visual C# 2010, Fourth Edition22 Selecting Identifiers (cont'd.)

Microsoft Visual C# 2010, Fourth Edition23 Selecting Identifiers (cont'd.)

Improving Programs by Adding Program Comments Program comments –Nonexecuting statements that document a program Comment out –Turn a statement into a comment Types of comments in C# –Line comments –Block comments –XML-documentation format comments Microsoft Visual C# 2010, Fourth Edition24

Adding Program Comments (cont'd.) Microsoft Visual C# 2010, Fourth Edition25

Using the System Namespace Microsoft Visual C# 2010, Fourth Edition26

Microsoft Visual C# 2010, Fourth Edition27 Using the System Namespace (cont'd.)

Microsoft Visual C# 2010, Fourth Edition28 Writing and Compiling a C# Program Steps for viewing a program output –Compile source code into intermediate language (IL) –C# just in time (JIT) compiler translates the intermediate code into executable statements You can use either of two ways to compile –The command line –The Integrated Development Environment (IDE)

Compiling Code from the Command Prompt What to do if you receive an operating system error message –Command csc Stands for “C Sharp compiler” Microsoft Visual C# 2010, Fourth Edition29

Microsoft Visual C# 2010, Fourth Edition Compiling Code from the Command Prompt (cont'd.) What to do if you receive a programming language error message –Program error messages start with the program name –Followed by the line number and position within the line of the error

Compiling Code from within the Visual Studio IDE Advantages of using the Visual Studio IDE –Some of the code you need is already created for you –The code is displayed in color –You can double-click an error message and the cursor will move to the line of code that contains the error –Other debugging tools are available Microsoft Visual C# 2010, Fourth Edition31

Compiling Code from within the Visual Studio IDE (cont'd.) Microsoft Visual C# 2010, Fourth Edition32

You Do It Enter your first C# program into a text editor so you can execute it Use any text editor to write the following code and save it as Hello.cs Microsoft Visual C# 2010, Fourth Edition33

Compiling and Executing a Program from the Command Line Type the command that compiles your program: csc Hello.cs Microsoft Visual C# 2010, Fourth Edition34

Compiling and Executing a Program from the Command Line (cont'd.) Execute the program Hello.exe Microsoft Visual C# 2010, Fourth Edition35

Compiling and Executing a Program Using the Visual Studio IDE Steps –Create a new project (console application) –Enter the project name –Write your program using the editor –To compile the program, click Build on the menu bar, and then click Build Solution As an alternative, you can press F6 –Click Debug on the menu bar and then click Start Without Debugging Microsoft Visual C# 2010, Fourth Edition36

Compiling and Executing a Program Using the Visual Studio IDE (cont'd.) Microsoft Visual C# 2010, Fourth Edition37

Compiling and Executing a Program Using the Visual Studio IDE (cont'd.) Microsoft Visual C# 2010, Fourth Edition38

Microsoft Visual C# 2010, Fourth Edition39 Compiling and Executing a Program Using the Visual Studio IDE (cont'd.)

Deciding Which Method to Use Advantage of using the command line –Saves disk space Advantages of using the Visual Studio IDE –Automatic sentence completion –Words are displayed using different colors based on their category –Code automatically generated by the IDE is very helpful when writing a GUI Microsoft Visual C# 2010, Fourth Edition40

Adding Comments to a Program Line comment example // Filename Hello.cs // Written by // Written on Block comment example /* This program demonstrates the use of the WriteLine() method to print the message Hello, world! */ Microsoft Visual C# 2010, Fourth Edition41

Summary A computer program is a set of instructions that tell a computer what to do Understand differences between procedural programming and object-oriented programming Objects are instances of classes and are made up of attributes and methods The C# programming language is an object- oriented and component-oriented language System.Console.WriteLine() method –Produces a line of console output Microsoft Visual C# 2010, Fourth Edition42

Summary (cont'd.) You can define a C# class or variable by using any name or identifier Comments are nonexecuting statements that you add to document a program –Or to disable statements when you test a program Use namespaces to improve programs To create a C# program, you can use the Microsoft Visual Studio environment Microsoft Visual C# 2010, Fourth Edition43