(c) Bob McKillop, 2006Tutorial #1 T1-1 Tutorial #1 - your first compiled code  the learning objectives for this tutorial are very modest q compile and.

Slides:



Advertisements
Similar presentations
Introduction to Programming using Matlab Session 2 P DuffourJan 2008.
Advertisements

COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions.
Introduction to Visual Basic.NET Uploaded By: M.Sheraz anjum.
Module 6: Introduction to C Language ITEI102 Introduction to Programming Structure of C++ Program - Programming Terminologies - Microsoft Visual Studio.
 2005 Pearson Education, Inc. All rights reserved Introduction.
1 Chapter 2 Introduction to Java Applications Introduction Java application programming Display ____________________ Obtain information from the.
Programming by Example Version 1.0. Objectives Take a small computing problem, and walk through the process of developing a solution. Investigate the.
HTML tags Skills: adding HTML tags, text editor IT concepts: plain text, computer components – storage versus memory, separation of content and format.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 06.
Your First C++ Program Aug 27, /27/08 CS 150 Introduction to Computer Science I C++  Based on the C programming language  One of today’s most.
 2002 Prentice Hall. All rights reserved. 1 Outline 3.1Introduction 3.2Simple Program: Printing a Line of Text 3.3Another Simple Program: Adding Integers.
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
Chapter 3: Introducing the Microsoft.NET Framework and Visual Basic.NET Visual Basic.NET Programming: From Problem Analysis to Program Design.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Creating an HTML page Skills: edit and debug HTML pages IT concepts: text editor This work is licensed under a Creative Commons Attribution-Noncommercial-
Command Console Tutorial BCIS 3680 Enterprise Programming.
Creating a Console Application with Visual Studio
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
Tutorial on Visual Studio express Introduction Visual Studio Express Editions are a new line of Microsoft development Tools. This line of products.
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
CS 2340: Programming in VB Instructor: Dr. Qi Yang Office: 213 Ullrich Phone: YangQ 1.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
Java Programming, 3e Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
Lecture 1: Introduction Lecture series based on the text: Essential MATLAB for Engineers and Scientists By Hahn & Valentine
A First Program Using C#
COS120 Software Development Using C++ AUBG Fall semester 2010 Ref book: Problem Solving, Abstraction and Design Using C++ Authors: Frank Friedman, Elliot.
ASP.NET Dr. Ralph Westfall May, Web Development Problem HTML designed to display static pages only interactive when user clicks links  can’t provide.
Module 1: Introduction to C# Module 2: Variables and Data Types
11 Getting Started with C# Chapter Objectives You will be able to: 1. Say in general terms how C# differs from C. 2. Create, compile, and run a.
Microsoft Visual Basic 2005: Reloaded Second Edition
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 2 - Welcome Application: Introduction to C++
Chapter 3 – Introduction to Visual Basic Programming
® Microsoft Access 2010 Tutorial 11 Using and Writing Visual Basic for Applications Code.
IE 411/511: Visual Programming for Industrial Applications
Chapter 3 Introducing Visual Basic.NET. 3.1 Visual Basic.NET Windows Programming -Used to create Windows, Web, and Console applications -Uses predefined.
Introduction to Programming Workshop 1 PHYS1101 Discovery Skills in Physics Dr. Nigel Dipper Room 125d
CS161 Topic #21 CS161 Introduction to Computer Science Topic #2.
®® Microsoft Windows 7 for Power Users Tutorial 13 Using the Command-Line Environment.
CSI 1390: Introduction to Computers TA: Tapu Kumar Ghose Office: STE 5014
UCSC All rights reserved. No part of this material may be reproduced and sold. 1 IT1202-Fundamentals Of Programming (Using JAVA) Interacting with.
A1 Visual C++.NET Intro Programming in C++ Computer Science Dept Va Tech August, 2002 © Barnette ND & McQuain WD 1 Quick Introduction The following.
1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.
Introduction to the Visual Studio.NET IDE (LAB 1 )
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 7 Using Menus, Common Dialogs, Procedures, Functions, and Arrays.
Lecture 6: Computer Languages. Programming Environments (IDE) COS120 Software Development Using C++ AUBG, COS dept.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
Introduction to Visual Basic Programming Introduction to Visual Basic Programming Ch3 – Deitel’s Book.
1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.
Dr. Qusai Abuein1 Internet & WWW How to program Chap.(6) JavaScript:Introduction to Scripting.
1 Getting Started with C++. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Visual Studio 2008.
Introduction to Visual Basic Programming. Introduction Simple Program: Printing a Line of Text Another Simple Program: Adding Integers Memory Concepts.
1 Programming Environment and Tools VS.Net 2012 First project MSDN Library.
Intermediate 2 Computing Unit 2 - Software Development.
Hands-on Introduction to Visual Basic.NET Programming Right from the Start with Visual Basic.NET 1/e 6.
Microsoft Visual Basic 2008: Reloaded Third Edition Chapter One An Introduction to Visual Basic 2008.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 – Introduction to C# Programming Outline 3.1 Introduction 3.2 Simple Program: Printing a Line.
Copyright (c) 2003 by Prentice Hall Provided By: Qasim Al-ajmi Chapter 2 Introduction to Visual Basic Programming Visual Basic.NET.
Introduction to Eclipse Programming with an Integrated Development Environment.
1 Getting Started with C++ Part 1 Windows. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Microsoft.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
CSx 4091 – Python Programming Spring 2013 Lecture L2 – Introduction to Python Page 1 Help: To get help, type in the following in the interpreter: Welcome.
1 8/30/06CS150 Introduction to Computer Science 1 Your First C++ Program.
Microsoft Visual Basic 2012: Reloaded Fifth Edition Chapter One An Introduction to Visual Basic 2012.
Chapter 2: The Visual Studio.NET Development Environment Visual Basic.NET Programming: From Problem Analysis to Program Design.
ASSIGNMENT OBJECTIVES
Apply Procedures to Develop Message, Input, and Dialog Boxes
Value-Returning Functions
How to Run a Java Program
Chapter 3 – Introduction to C# Programming
POS 408 Week 1 Individual Assignment Individual: Console Display Message//tutorfortune.com Click on below link to buy
Presentation transcript:

(c) Bob McKillop, 2006Tutorial #1 T1-1 Tutorial #1 - your first compiled code  the learning objectives for this tutorial are very modest q compile and execute three VB.NET console applications on the NEXUS system q program 1 – Hello World! q program 2 – obtaining the user’s name from the console q program 3 – computing the real roots of a quadratic equation  the purpose of the tutorial is to provide practice writing, compiling and executing simple code snippets.  you are NOT expected to understand anything that you type! Assignment #1  each student is asked modify program #3 and submit an improved version of program #3 before noon on Friday.

(c) Bob McKillop, 2006Tutorial #1 T1-2  using the Windows Start Menu, select: >>All Programs >>Programming >>Microsoft Visual Studio.NET 2003 >>Visual Studio. NET Tools >> Visual Studio.NET 2003 Command Prompt

(c) Bob McKillop, 2006Tutorial #1 T1-3  your screen should now display the Visual Studio.NET Command Prompt  your prompt should indicate that you are presently working on the N: drive n:  if not, type n: and hit the Enter key

(c) Bob McKillop, 2006Tutorial #1 T1-4 vbc  type vbc and hit the Enter key  your screen should now include a listing of the Visual Basic compiler options  it is not as scary as it looks. We will be using only a few of the compiler options.

(c) Bob McKillop, 2006Tutorial #1 T1-5 cls  type cls to clear the screen display  let’s make a working directory (folder) on your n: drive md cive121  type md cive121 and hit the Enter key. cd cive121  type cd cive121 and hit the Enter key dir  type dir and hit the Enter key. The display should list the contents of your newly created directory (folder). In our case, there should be no files located within the directory…yet

(c) Bob McKillop, 2006Tutorial #1 T1-6 Program #1  you will need a code editor for this course  there are plenty of free code editors available on the web (NotePad2, EditPad Lite, etc.) NotePad  for today, use the default NotePad editor provided with Windows. From the Windows Start Menu, choose: >>All programs >>Accessories >>NotePad  open the text editor and carefully enter the following code hello.vbcive121  save your untitled document as hello.vb and be sure to save it in the cive121 directory

(c) Bob McKillop, 2006Tutorial #1 T1-7 dir hello.vb  at the command prompt, type dir and hit the Enter key. You should now see your newly created text file name hello.vb within the directory listing vbc hello.vb  type vbc hello.vb and hit the Enter key. Hopefully, your program compiles successfully. dir hello.exe  at the command prompt, type dir and hit the Enter key. You should now see your newly created hello.exe executable

(c) Bob McKillop, 2006Tutorial #1 T1-8 hellohello.exe  at the command prompt, type hello (or hello.exe) and hit the Enter key. Hello World!  you should now see the message Hello World! displayed on your console  congratulations, you have successfully created, compiled and executed your first VB.NET program!

(c) Bob McKillop, 2006Tutorial #1 T1-9 Commenting your code  It is important to appreciate this simple fact…a computer program is to be executed by a computer but it will be read by other people q large programs may involve dozens if not hundreds of programmers q most programs undergo: significant modification and/or upgrading fixing bugs/errors q it is important to comment our code in order for other people to understand how our program works, today or several years from now. q in many cases, a programmer will revisit his/her own program after several months ors year and it is easy to forget some of the important details about your own code `  in VB.NET, the compiler ignores any instructions located to the right of an apostrophe (`)

(c) Bob McKillop, 2006Tutorial #1 T1-10  comment your previous code as follows. ‘ ============================================================================ ‘ Program #1 ‘ Written by: Bob McKillop ‘ Date: January 03, 2006 ‘ ============================================================================ ‘ impose strict type checking Option Strict On ‘ impose strict type checking ‘ import system namespace Imports System ‘ import system namespace Module MyFirstProgram Public Sub Main() ‘ direct output stream to Console.WriteLine("Hello World!") ‘ direct output stream to ‘ the console End Sub End Module  compile and execute your program and observe the program output

(c) Bob McKillop, 2006Tutorial #1 T1-11 Program #2  program #1 provided an easy introduction to compiling and executing a VB program but…the program did not accept any input and it did not make use of any variables (data) hello.vbintro.vb  save your hello.vb program as intro.vb  we will now modify the previous program in order to prompt the user for his/her first name  the program will then offer an introductory greeting to the user as illustrated below:

(c) Bob McKillop, 2006Tutorial #1 T1-12  enter the following code. Compile and execute the program. When prompted, type in your name and hit the key. ‘ ============================================================================ ‘ Program #2 ‘ Written by: Bob McKillop ‘ Date: January 03, 2006 ‘ ‘ Modified: January 03, 2006 by Bob McKillop ‘ Added ReadLine method in order to obtain users first name ‘ from the Console ‘ ============================================================================ ‘ impose strict type checking Option Strict On ‘ impose strict type checking ‘ import System namespace Imports System ‘ import System namespace Imports System.IO‘ import System.IO namespace Imports System.IO ‘ import System.IO namespace Module Program_02 Public Sub Main() Console.WriteLine() Dim name As String ‘ Declare String object Dim name As String ‘ Declare String object Console.Write("Please type your first name: ") Console.Write("Please type your first name: ") name = Console.ReadLine() ‘ Obtain input stream name = Console.ReadLine() ‘ Obtain input stream Console.WriteLine() Console.WriteLine() Console.WriteLine ("Hello " & name) Console.WriteLine ("Hello " & name) Console.WriteLine ("Welcome to the course!") Console.WriteLine ("Welcome to the course!") End Sub End Module

(c) Bob McKillop, 2006Tutorial #1 T1-13 Program #3 intro.vbquadratic.vb  save your intro.vb program as quadratic.vb  our previous programs did not perform any computations and program #2 made use of a single String type.  let’s write a program capable of computing the roots of an expression of the form:  recall that the closed-form solution is given by:  for this problem, assume that real roots always exist  test your program using q a = 1 q b = 3, and q c = -18

(c) Bob McKillop, 2006Tutorial #1 T1-14  enter the following code. Compile and execute the program. ' ========================================================================== ' Program #3 ' Written By: Bob McKillop ' Date: January 03, 2006 ' Purpose To compute quadratic roots ' Inputs Constants a, b and c ' Outputs The 2 real roots ' Limitations This program does not check for the existence of ' non-existing or complex roots ' ========================================================================== Option Strict On Imports System 'Import System.Math namespace Imports System.Math 'Import System.Math namespace Module Program_03 Public Sub Main() Dim a As Double = 1 Dim b As Double = 3 Dim c As Double = -18 Dim root1, root2 As Double Dim term As Double term = b ^ * a * c root1 = (-b + Sqrt(term)) / (2 * a) root2 = (-b - Sqrt(term)) / (2 * a) Console.WriteLine ("The first root is {0,6:F2}", root1) Console.WriteLine ("The second root is {0,5:F2}", root2) End Sub End Module

(c) Bob McKillop, 2006Tutorial #1 T1-15 Assignment #1  Modify program #3 in order for the following output to be exactly produced: Friday January 06  Before Friday January 06 (at noon), submit to the WEEF assignment box: q a listing of your program code. Make sure your code includes a fully completed and signed program header, available on the course web site (see page 3-9 of the course notes for more details). If you are having difficulty with console output, refer to some of the example code provided in Chapter 5 of the course notes. q a screen capture illustrating your program output