Prepared By: Deborah Becker

Slides:



Advertisements
Similar presentations
What Does This Program Do?
Advertisements

Input Dialog Box An input dialog box can be used to obtain a single item of input from the user Presents a window (dialog box) requesting input Syntax:
Fundamentals of Programming in Visual Basic
VB Built-in Functions School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 5, Monday 2/10/03)
Python November 14, Unit 7. Python Hello world, in class.
File Input and Output Sequential Access Files. Format Function Syntax: –Format( expression, “format” ) Example: lblNumber.Caption = “You owe ” & Format(dblSum,
Introduction to Computing Dr. Nadeem A Khan. Lecture 11.
Introduction to Computing Dr. Nadeem A Khan. Lecture 6.
Introduction to Python
On to… string operations & functions. Concatenation (&) §When we want to combine two character strings into one new (longer) string, we can concatenate.
Basic Elements of C++ Chapter 2.
CS0004: Introduction to Programming Input and Output.
Intrinsic Functions Pre-coded Functions Used to improve developer productivity Broad Range of Activities Math calculations Time/Date functions String.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
1 © 2000 John Urrutia. All rights reserved. Qbasic Constructing Qbasic Programs.
1 Chapter 3 – Variables, Input, and Output 3.1 Numbers 3.2 Strings 3.3 Input and Output.
Pascal Programming Strings, Arithmetic operators and output formatting National Certificate – Unit 4 Carl Smith.
Input, Output, and Processing
3 - Variables Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Input Textboxes Input Boxes Different than textboxes Good for small amount of input (form full of textboxes is not nice) X = Inputbox(“prompt message”,
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 2 Input, Processing, and Output.
Numbers continued The Integer Data Type Multiple Declarations Parentheses Three Types of Errors.
Chapter 8 - Visual Basic Schneider
Variable, Constants and Calculations Dr Mohammad Nabil Almunawar.
Introduction to Programming Fundamentals of Programming in Visual Basic.
1 Chapter 3 – Examples The examples from chapter 3, combining the data types, variables, expressions, assignments, functions and methods with Windows controls.
Hungarian Notation A must in this course Every object used MUST be renamed including the form(s) using the following rules Form  frmFormName E.g. frmTemperature.
© 2006 ITT Educational Services Inc. Introduction to Computer Programming: Unit 3: Chapter 3: Slide 1 Unit 3 Formatting Chapter 3 Input, Variables, Constants,
Knowledge Base. Defining a Variable Dim statement Dim intXX As Integer Public in a Module Public dblNN As Double.
1 VB-06-String Manipulation Mar 03, 2002 String Function VISUAL BASIC.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
Chapter 3 - Visual Basic Schneider. Private Sub cmdEvaluate_Click() Dim n As Single, root As Single n = 6.76 root = Sqr(n) picResults.Print root; Int(n);
2.3 Output Formatting. Outputting Format Specify the number of spaces, “c”, used to print an integer value with specifier %cd, e.g., %3d, %4d. E.g. printf.
A variable is a name for a value stored in memory.
Chapter Topics The Basics of a C++ Program Data Types
Topics Designing a Program Input, Processing, and Output
Arithmetic operations and operators, converting data types and formatting programs for output. Year 11 Information Technology.
Introduction to Python
Formatted Input/Output
Formatting Output.
Project 9 Creating Pop-up Windows, Adding Scrolling Messages, and Validating Forms.
Basic Elements of C++.
Design & Technology Grade 7 Python
Variables, Expressions, and IO
Chapter 3: Expressions and Interactivity.
Chapter 3 Java Input/Output.
Formatting Output.
Functions CIS 40 – Introduction to Programming in Python
Formatted Input/Output
OUTPUT STATEMENTS GC 201.
Basic Elements of C++ Chapter 2.
Fundamentals of Programming in Visual Basic
CSCE 206 Lab Structured Programming in C
Input and Output.
Variables and Expressions
Chapter 3 Input/Output.
Visual Basic Numbers Chapter 3.3 Prepared By: Deborah 1/15/2019.
Topics Designing a Program Input, Processing, and Output
VBScript Session 10.
Topics Designing a Program Input, Processing, and Output
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
Topics Designing a Program Input, Processing, and Output
Data Types and Expressions
Topics Designing a Program Input, Processing, and Output
Input and Output.
Unit 3: Variables in Java
CSCE 206 Lab Structured Programming in C
Visual Basic Numbers Chapter 3.3 Prepared By: Deborah 7/9/2019.
Input and Output Chapter 3.5
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Prepared By: Deborah Becker Built-In Functions Chapter 3.6 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker Topics Common Built-In Functions Numeric Functions Val() and Str() String Functions Formatting Functions 1/18/2019 Prepared By: Deborah Becker

Common Built-In Functions Types Formatting Numeric String Date & Time File handling 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker Formatting & Printing Using the Print Zones Each line in a Picture box object or paper line is divided into zones. Each zone contains 14 positions about the size of a printed character We use the Print method of the picture box to display our output We use Commas and Semicolons to separate items on the print line Using Commas will display the data in different print zone Using Semicolons will display the data in a line with no spaces. 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker Examples picDisplay.Print strName, strPhone 123456789012345678901234567890123456789 Deborah Becker (816)271-4521 picDisplay.Print strname; strPhone Deborah Becker(816)271-4521 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker The Tab() function Tab(n) This function is used to position data into the various positions on the print line n Represents the position on the line where the data item will print. Example picDisplay.Print strName; Tab(20); strPhone 123456789012345678901234567890 Deborah Becker (816)271-4521 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker Spc() Function The Spc(n) function is used Print and Print# statements to generate spaces. Example picDisplay.Print strName; Spc(5); strPhone 12345678901234567890123456789 Deborah Becker (816)271-4521 1/18/2019 Prepared By: Deborah Becker

Common Numeric Functions Sqr(NumericVariable) Sqr(9) = 3 Sqr(319) = 17.86057 Int(NumericVariable) Int(3*5.9) = 17 Int(-2.7) = 3 The values inside the function can be number, numeric variables or numeric expressions Round(curPartPrice * IntQtyOrder, Digits) Round(2.356 * 5, 3) = 11.780 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker Other Functions Val(Text Expression) User Input into TextBox Store results of Calculation Converts string variable to numeric value Produces an error if input is not numeric Useful is data is stored in string format Str(Numeric Expression) Converts Input in a TextBox to Numeric 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker Solve These Functions sngPrice = Val(“3.16”)*5 sngPrice = int(3.16 * 5) sngPrice = Round(3.16*5) sngPrice = int(3.16) * 5 15.8 15 15.8 15 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker String Functions Left(strVariable,Number of Characters) Mid(strVariable, StartPosition,#Characters) Ucase(srtVariable) Trim(“ 1 2 “) Right(strVariable, Number of Characters) From the right most character Len(strVariable) Instr(strVariable, String Pattern) Returns the starting position in the string 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker Solve These Examples Left(“CIS202”, 3) Right(“CIS202”,3) Mid(“Visual Basic”, 3, 2) Ucase(“visual Basic”) Lcase(“COMPUTERS”) Len(“Watcher, the Movie”) Instr(“Watcher, the Movie”, “at”) If the str2 is not a subset of str1 the values = 0 Else if str2 is a subset of str1 the value = the starting position of str2. (2) Trim(“ This class is too Early “) 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker Date and Time Function FormatDateTime(dtmClassTime,vbLongDate) FormatDateTime(dtmClassTime,vbShortDate) Monday, September 18, 2000 09/18/00 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker Formatting Numbers Format(FormatNumber(12345),@@@@@) The @ formating symbol is used to line up numbers and decimal points in output Format(FormatNumber(1234.5),@@@@@) FormatNumber() FormatCurrency() FormatPercent() FormatDateTime() 1/18/2019 Prepared By: Deborah Becker

Prepared By: Deborah Becker Setting TxtBox.Text txtBox.text = FormatNumber(1234.56,0) txtBox.text = FormatCurrency(123.45) txtBox.text = FormatCurrency(123.45,0) Use a format function to correctly display the following 1050.56 currency 09/18/00 long date 250.25 currency no cents 1/18/2019 Prepared By: Deborah Becker