Introduction to Computing Dr. Nadeem A Khan. Lecture 8.

Slides:



Advertisements
Similar presentations
Chapter 2 Review Questions
Advertisements

Fundamentals of Programming in Visual Basic
Introduction to Computing Dr. Nadeem A Khan. Lecture 21.
Introduction to Computing Dr. Nadeem A Khan. Lecture 9.
What Data Do We Have? Sections 2.2, 2.5 August 29, 2008.
Introduction to Computing Dr. Nadeem A Khan. Lecture 10.
Introduction to Computing Dr. Nadeem A Khan. Lecture 23.
Fundamentals of Programming in Visual Basic
Introduction to Computing Dr. Nadeem A Khan. Lecture 22.
Introduction to Computing Dr. Nadeem A Khan. Lecture 10.
Introduction to Computing Dr. Nadeem A Khan. Lecture 27.
Introduction to Computing Dr. Nadeem A Khan. Lecture 7.
Chapter 31 Fundamentals of Programming in Visual Basic (Continue IV) Strings Variables and Strings Using Text Boxes for Input and Output Concatenation.
Introduction to Computing Dr. Nadeem A Khan. Lecture 4.
Introduction to VB prepared by Dr. I A Moneim Reference Book Schneider.
1 9/1/06CS150 Introduction to Computer Science 1 What Data Do We Have? CS 150 Introduction to Computer Science I.
Introduction to Computing Dr. Nadeem A Khan. Lecture 4.
Introduction to Computing Dr. Nadeem A Khan. Lecture 4.
Introduction to Computing Dr. Nadeem A Khan. Lecture
Introduction to Computing Dr. Nadeem A Khan. Lecture 24.
Introduction to Computing Dr. Nadeem A Khan. Lecture 17.
Introduction to Computing Dr. Nadeem A Khan. Lecture 19.
Introduction to Computing Dr. Nadeem A Khan. Lecture 11.
Introduction to Computing Dr. Nadeem A Khan. Lecture 7.
1 September 6, 2005CS150 Introduction to Computer Science I What Actions Do We Have Part 1 CS150 Introduction to Computer Science I.
Introduction to Computing Dr. Nadeem A Khan. Lecture 14.
Introduction to Computing Dr. Nadeem A Khan. Lecture 6.
Introduction to Computing Dr. Nadeem A Khan. Lecture 28.
Visual Basic Statements
Introduction to Computing Dr. Nadeem A Khan. Lecture 13.
Introduction to Computing Dr. Nadeem A Khan. Lecture 18.
Section Schneider zThis section introduces nice ways to produce input & display output: yInput boxes yMessage boxes.
Chapter 31 Fundamentals of Programming in VB(Continue I) Numbers Arithmetic Operations Variables Incrementing the Value of a Variable.
Introduction to Computing Dr. Nadeem A Khan. Lecture 8.
Fundamentals of Programming in Visual Basic
Introduction to Computing Dr. Nadeem A Khan. Lecture 9.
Introduction to Computing Dr. Nadeem A Khan. Lecture 5.
INTRODUCTION TO PYTHON PART 2 INPUT AND OUTPUT CSC482 Introduction to Text Analytics Thomas Tiahrt, MA, PhD.
For…Next : Nested Loop X= 0 For i = 0 To 4 For j = 0 To i-1 X=X+(i+j-1) Next j Next i How many times the inner loop is executed? What is x at the end of.
Variables & Math Operators CE 311 K - Introduction to Computer Methods Daene C. McKinney.
1 Chapter 3 – Variables, Input, and Output 3.1 Numbers 3.2 Strings 3.3 Input and Output.
Created By Mayson Al-Duwais1. Using Exit to Terminate Repetition Statements To terminate different types of repetition statements you can use a special.
PHP : Hypertext Preprocessor
.NET Library Objects So far we have looked at the following objects in learning about ASP.NET: Controls Used to control the screen / interface and gather.
Chapter 2 Practice.
1 Chapter 3 – Variables, Input, and Output 3.1 Numbers 3.2 Strings 3.3 Input and Output.
1 Chapter 3 – Variables, Input, and Output 3.1 Numbers 3.2 Strings 3.3 Input and Output.
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
First steps Jordi Cortadella Department of Computer Science.
Numbers continued The Integer Data Type Multiple Declarations Parentheses Three Types of Errors.
Class 3 Remote Instruction Computer Math EDU 556 Programming for Instruction Dr. Steve Broskoske This is an audio PowerCast. Make sure your volume is.
The PC GadgetMaster II Stepper Motor Control Developed by Frank Shapleigh Edited by Jim Tuff.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Introduction to Programming Fundamentals of Programming in Visual Basic.
Chapter 3 - Visual Basic Schneider Numeric Variables Used to store numbers Value is assigned by a statement of the form: numVar = expression The variable.
Introduction to Computing Dr. Nadeem A Khan. Lecture 7.
Introduction to Computing Dr. Nadeem A Khan. Lecture 9.
Slide 1 Controls v Control naming convention –Label: lblName –Command Button: cmdName –Text Box: txtName.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Loop and repetition. Today Passing values to and back from Sub procedures Option Buttons Do While Loops For Loops Population Growth.
Data and variables in Visual Basic. Annoucement Lecture on Thursday 7:30PM C106 Visual Basic download: 
Knowledge Base. Defining a Variable Dim statement Dim intXX As Integer Public in a Module Public dblNN As Double.
3.4 Strings Variables and Strings Using Text Boxes for Input and Output Concatenation ANSI Character Set String Properties and Methods: LengthToUpper TrimToLower.
Chapter 3 - VB 2008 by Schneider1 Chapter 3 – Variables, Input, and Output 3.1 Numbers 3.2 Strings 3.3 Input and Output.
Sub Procedures and Functions Visual Basic. Sub Procedures Slide 2 of 26 Topic & Structure of the lesson Introduction to Modular Design Concepts Write.
Introduction to Python Lesson 2a Print and Types.
Introduction to Computing Dr. Nadeem A Khan. Lecture 24.
Introduction to Computing Dr. Nadeem A Khan. Lecture 21.
What Actions Do We Have Part 1
Introduction to Programming
Presentation transcript:

Introduction to Computing Dr. Nadeem A Khan

Lecture 8

Scientific Notation ► E=Exponent => Exponent of 10 E.g.  1.2E+04 = 1.2 * 10^4 =  1.2E+34 = 1.2 * 10^34  1E-02 = 1 * 10^-2 =.01

Scientific Notation (Contd.) ► Display notation (Scientific or Standard) depends on magnitude

► What this code will do? Let num1 = 6 Picture1.Print num1 Picture1.Print num1

Variables (Contd.) Conclusions: ► A variable holds a value ► The value can be assigned and then used

Variables (Contd.) ► What will this code do? Let result = 100*4 Picture1.Print result Picture1.Print result

Variables (Contd.) ► What will this code do? Let speed=50.3 Let speed=50.3 Let timeElapsed =2 Let timeElapsed =2 Let distance = speed*timeElapsed Picture1.Print distance Picture1.Print distance

Variables (Contd.) ► Conclusions: The General Form: Let var = expression e.g.:Distance=speed*timeElapsed c= a*(2.2+b)+6 counter=counter+1

String Variables Sub Command1_Click () Picture1.Cls Picture1.Print “hello” Let today = “9/17/95” Let message = “students of CS101” Picture1.Print today Picture1.Print “hello”; message End Sub

String Variables (Contd.) ► Result: hello9/17/95 hellostudents of CS101

String Variables (Contd.) ► Concatenation (use + or &) Sub Command1_Click () Picture1.Cls Let message_part1 = “hello” Let message_part2 = “students of CS101” Let message= message_part1+message_part2 Picture1.Print message Picture1.Print message + “ on Sept. 19,2002” Let message= message_part1 & “ world” Picture1.Print message End Sub

String Variables (Contd.) ► Displayed Result hellostudents of CS101 hellostudents of CS101 on Sept. 19,2002 hello world

Declaring Variable Types ► Dim var As String ► Dim var As Single

Declaring Variable Types (Contd.) ► Example program: Sub Command1_Click () Dim interestRate As Single Dim principal As Single Dim phrase as String Picture1.Cls Let InterestRate=.0655 Let principal =100 Let phrase =“The balance after a year is” Picture1.Print phrase;(1+interestRate)*principal End Sub

Declaring Variable Types (Contd.) ► Displayed Result: The balance after a year is

Declaring Variable Types (Contd.) ► Different ways of declaration  Dim interestRate As Single, principal As Single, phrase As String  Dim name$ (same as Dim name As String)  Dim price! (same as Dim price As Single)  Use the type declaration tag while using it E.g.: Let name$ = “John” Let price! = 65.66

Input/Output Using Text Box ► Contents of a text box is always a string ► Output the string by  Let Text1.Text= strvar ► Input the string by  Let strVar =Text1.Text

Input/Output Using Text Box (Contd.) ► Numbers in a textbox are also stored as strings ► Input a number by  Let numVar = Val(Text1.Text) ► Output a number by  Let Text1.Text=Str$(numVar)

Another example: Sub Command1_Click() Picture1.Cls Let rate = 50 Let timeElapsed = 14 Let distance = rate * timeElapsed Picture1.Print distance Let distance = 410 Let timeElaspsed = distance / rate Picture1.Print timeElapsed End Sub