Section 7 The BASIC Language II

Size: px
Start display at page:

Download "Section 7 The BASIC Language II"

Transcription

1 Dates Section 7 The BASIC Language II The Date class holds a date (between January 1 st, 0001 and December 31 st, 9999) combined with a time (between 0:00:00 and 23:59:59) Constructors of the Date class allow you to initialise it with day, month, year, etc. The CDate( ) function converts a String to a Date, but will generate an error if the String isn t appropriate use of the IsDate( ) function is recommended Dim s As String = "21/12/1908" Dim d As Date If IsDate(s) Then d = CDate(s) MsgBox(d.ToLongDateString()) End If To add and subtract dates, use: DateAdd(interval, number, date) Dim d As New Date(2008, 2, 25) Dim d2 As Date d2 = DateAdd(DateInterval.Day, 5, d) MsgBox("5 days after " & d.toshortdatestring() & " is " & d2.toshortdatestring()) d2 = DateAdd(DateInterval.Month, -6, d) MsgBox("6 months before " & d.toshortdatestring() & " is " & d2.toshortdatestring())

2 To calculate the difference (elapsed period) between two dates, use: DateDiff(interval, date1, date2) Dim i As Long i = DateDiff(DateInterval.Day, d, d2) To extract a specified component (year, month, minute, etc.) from a date, use: DatePart(interval, date) MsgBox("The current hour is: " & DatePart(DateInterval.Hour, Now())) The DateTimePicker control Makes it very simple for users to enter a Date, Time, or Date+Time The Value property gives you the actual date selected

3 Use the Format property to specify what you want to be displayed and selectable by the user Format Long : Format Short : Format Time : Built-in Data Structures Arrays o Fundamental mechanism in computing o One name, multiple values, arranged as an indexed list.net Collection Classes o ArrayLists o HashTables o Dictionaries

4 o Stacks and Queues Arrays: Lists of items are written, one at a time, to successive slots in an array Items can be retrieved by index The array can be reorganized e.g. sorted into alphabetical or numeric order, items removed, inserted etc. Limitations are as for any type of list: o Difficult to insert items without disturbing existing ones (unless empty space is built-in) o Removing an item leaves a hole o Locating an item usually requires an exhaustive search (start at first item and check each until desired item is found) Overcoming these limitations requires programming, or using an alternative data structure Other Data Structures / Collection Classes: ArrayList o Like an array, but no need to specify size o Add new items with the.add() method HashTable o A fast-access data structure. Items are searched/retrieved in a time that is almost independent of the number of them o Uses a Key object (usually a string) as a lookup value for the Item Queue o Like a real queue items join at the back and leave from the front SortedList

5 o Items added to a SortedList are inserted into the list in a pre-defined order (alphabetical, numerical, by date etc.). o Insertion is slower than adding an item to the end of an array, but retrieval is much faster (binary search) Stack o A pile of items added to and removed from the top only Collection o A general-purpose list of arbitrary items/objects, held in the order they were added in Dictionary o A Key-Value pair list, designed, like HashTable, for looking up items by their associated key. o Available only as a base class for customizing to a specific purpose Collections A collection object allows you to store members of any data type, including object data types and even other collection objects, and retrieve them using a unique key Similar to associative arrays in other modern languages (which refers to an array indexed by something more meaningful than a simple number) Methods of the Collection class: o Add (item [, key, before, after] ) If you don t specify before or after, the item is added at the end

6 If you don t specify a key, the item is indexed by integer (same as an array) o Count o Item(key) o Remove(key) Example: (BankCollection.sln) Public Class Form1 Dim accounts As New Collection ' collection of bank accounts Dim b As BankAccount ' currently logged-in instance Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Height = 126 Private Sub btnlogin_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.click ' does account exist with this name? Try b = accounts.item(txtname.text) ' account exists: is password correct? If (b.testpassword(txtpassword.text)) Then ' password correct ' flow of control will pass to below the Try..End Try block Else ' password wrong MsgBox("Incorrect Password!", MsgBoxStyle.Critical) Return End If Catch ' no account with that name: create one? Dim prompt As String prompt = "There is no account with the name " & txtname.text & ", do you want to create one?" If MsgBox(prompt, MsgBoxStyle.Information Or MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then

7 0) ' do create one b = New BankAccount(txtName.Text, txtpassword.text, accounts.add(b, txtname.text) Else ' don't create one Return End If End Try ' we only arrive here if an account is logged in Me.Height = 223 txtdetails.text = b.getdetails() Private Sub btndeposit_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btndeposit.click Dim amt As Integer Try amt = CInt(InputBox("Deposit How Much? ")) b.deposit(amt) txtdetails.text = b.getdetails() Catch End Try Private Sub btnwithdraw_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btnwithdraw.click Dim amt As Integer Try amt = CInt(InputBox("Withdraw How Much? ")) b.withdraw(amt) txtdetails.text = b.getdetails() Catch End Try End Class Public Class BankAccount Public AccountName As String Private Password As String Private Balance As Decimal Public Sub New(ByVal Name As String) AccountName = Name Public Sub New(ByVal Name As String, ByVal Pass As String, ByVal Initial As Decimal) AccountName = Name Password = Pass Balance = Initial Public Sub Deposit(ByVal amt As Integer) Balance += amt Public Sub Withdraw(ByVal amt As Integer) Balance -= amt

8 Public Function GetDetails() Return AccountName & ControlChars.CrLf & "Balance: " & Balance End Function Public Function testpassword(byval Pass As String) Return (Pass = Password) End Function End Class To iterate through objects held in a Collection Classes, use For Each : Dim s As String = "" Dim ba As BankAccount For Each ba In accounts s = s & ba.getdetails() & ControlChars.CrLf Next MsgBox(s) HashTable example: Note that Hash Tables do not easily support being iterated through The point of a HashTable is to provide fast look-up (random) access to the elements, not to provide access to the elements in sequence Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim ht As New Hashtable Dim P1 As New Person(111, "Saravanan", 26) Dim P2 As New Person(222, "Selvakumar", 26) Dim P3 As New Person(333, "Venkatesh", 27) ht.add(p1.id, P1) ht.add(p2.id, P2) ht.add(p3.id, P3) Console.WriteLine("Number of items in the HashTable are : " & ht.count) Dim P As Person If ht.contains(111) Then Console.WriteLine("Record Found!") P = CType(ht.Item(111), Person) Console.WriteLine("The age of " & P.name & " is " & P.age) Else Console.WriteLine("Record Not Found!")

9 End If End Class Public Class Person Public id As Integer Public name As String Public age As Integer Public Sub New(ByVal i As Integer, ByVal s As String, ByVal a As Integer) id = i name = s age = a End Class Queue Example: Dim q As New Queue q.enqueue("one") q.enqueue("two") q.enqueue("three") q.enqueue("four") q.enqueue("five") Console.WriteLine("Number of items in the Queue are : " & q.count) While q.count > 0 Console.WriteLine(q.Dequeue()) End While Stack Example: Dim s As New Stack s.push("one") s.push("two") s.push("three") s.push("four") s.push("five") Console.WriteLine("Number of items in the Stack are : " & s.count) While s.count > 0 Console.WriteLine(s.Pop()) End While Advantages of Sorted Lists In a list of items in random order, it is necessary to do an exhaustive search when looking for an item that might be in the list Just because we have not met it yet does not mean it is not there

10 With a sorted list, it is only necessary to look until you reach the point where the item should have been inserted (in the sort order) For example, searching for a particular Smith in the phone book, you would know to give up once you got beyond the entries for Smith There are even bigger benefits to searching a sorted list, since it is possible to use a Binary Search algorithm At each step of the search, able to dismiss ½ of the remaining items To perform a binary search in.net, use a SortedList collection, or an Array to which the Sort() method has been applied, and use the BinarySearch method (see section 3 of this course) Formatting Numbers The FormatNumber() function returns a value formatted as a number. Its general format is: FormatNumber(value [, trailing digits] [, leading digit] [, parentheses] [, group digits])

11 trailing digits is an integer giving the number of digits following the decimal point; the default is rounding to 2 digits leading digit (Boolean) indicates whether a leading 0 is to appear before the decimal point for fractional values parentheses (Boolean) indicates whether negative numbers should be displayed inside parentheses group digits (Boolean) indicates whether numbers should be grouped between commas. Format Output FormatNumber( ) 12, FormatNumber( ,5) 12, FormatNumber( ,,,,False) FormatNumber( ) -12, FormatNumber( ,,,True) (12,345.68) FormatNumber(.6789) 0.68 FormatNumber(.6789,,False).68 FormatNumber(-.6789,4) Formatting Dates and Times The FormatDateTime() function returns a string expression representing a date/time value: FormatDateTime(value [, DateFormat.format]) value is a date or time value format is one of the following values: GeneralDate, LongDate, ShortDate, LongTime, or ShortTime. FormatDateTime(Now) Format Output 3/6/2008 5:25:55 PM

12 FormatDateTime(Today) 3/6/2008 FormatDateTime(TimeOfDay) 5:25:55 PM FormatDateTime(Now,DateFormat.LongDate) Thursday, March 06, 2008 FormatDateTime(Today,DateFormat.LongDate) Thursday, March 06, 2008 FormatDateTime(Now,DateFormat.ShortDate) 3/6/2008 FormatDateTime(Today,DateFormat.ShortDate) 3/6/2008 FormatDateTime(Now,DateFormat.LongTime) 5:25:55 PM FormatDateTime(TimeOfDay,DateFormat.LongTime) 5:25:55 PM FormatDateTime(Now,DateFormat.ShortTime) 17:25 FormatDateTime(TimeOfDay,DateFormat.ShortTime) 17:25 General Formatting The Format() function is a general-purpose function that returns a string value formatted according to a format string. The format strings duplicate numeric and date/time formats produced by the specialized formats described above. Format(value, "format string") The characters shown in the following table are used to compose the format string. Character 0 #., Description Digit placeholder. Displays a digit or a zero. If the value has a digit in the position, then it displays; otherwise, a zero is displayed. Digit placeholder. Displays a digit or a space. If the value has a digit in the position, then it displays; otherwise, a space is displayed. Decimal placeholder; determines how many digits are displayed to the left and right of the decimal separator. Thousand separator; separates thousands from hundreds within a number that has four or more places to the left of the decimal separator. Only a single "," is required in the format, between the first set of digit

13 % placeholders. Percent placeholder. Multiplies the expression by 100. The percent character (%) is inserted in the position where it appears in the format string. - + $ ( ) Literal characters; displayed exactly as typed in the format string. Examples: Format Output Format( ,"0.00") Format( ,"0,0.000") 12, Format( ,"00000, ") 012, Format( ,"#.##") Format( ,"#,#.##") 12, Format( ,"$ #,#.##") $ 12, Format( ,"#,#.####") -12, Format( ,"$#,#.##") -$12, Format(.6789,"#,#.##").68 Format(.6789,"0,0.000") Format(-.6789," ") Format(.6789,"0.00%") 67.89%

Revision for Final Examination (Second Semester) Grade 9

Revision for Final Examination (Second Semester) Grade 9 Revision for Final Examination (Second Semester) Grade 9 Name: Date: Part 1: Answer the questions given below based on your knowledge about Visual Basic 2008: Question 1 What is the benefit of using Visual

More information

Learning VB.Net. Tutorial 19 Classes and Inheritance

Learning VB.Net. Tutorial 19 Classes and Inheritance Learning VB.Net Tutorial 19 Classes and Inheritance Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you

More information

Mr.Khaled Anwar ( )

Mr.Khaled Anwar ( ) The Rnd() function generates random numbers. Every time Rnd() is executed, it returns a different random fraction (greater than or equal to 0 and less than 1). If you end execution and run the program

More information

11. Persistence. The use of files, streams and serialization for storing object model data

11. Persistence. The use of files, streams and serialization for storing object model data 11. Persistence The use of files, streams and serialization for storing object model data Storing Application Data Without some way of storing data off-line computers would be virtually unusable imagine

More information

In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result.

In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result. Simple Calculator In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result. Let s get started First create a new Visual Basic

More information

Unit Title: Objects in Visual Basic.NET. Software Development Unit 4. Objects in Visual Basic.NET

Unit Title: Objects in Visual Basic.NET. Software Development Unit 4. Objects in Visual Basic.NET Software Development Unit 4 Objects in Visual Basic.NET Aims This unit proceeds to the heart of object-oriented programming, introducing the mechanisms for creating new classes of object, defining their

More information

Lecture 10 OOP and VB.Net

Lecture 10 OOP and VB.Net Lecture 10 OOP and VB.Net Pillars of OOP Objects and Classes Encapsulation Inheritance Polymorphism Abstraction Classes A class is a template for an object. An object will have attributes and properties.

More information

Text Input and Conditionals

Text Input and Conditionals Text Input and Conditionals Text Input Many programs allow the user to enter information, like a username and password. Python makes taking input from the user seamless with a single line of code: input()

More information

Learning VB.Net. Tutorial 10 Collections

Learning VB.Net. Tutorial 10 Collections Learning VB.Net Tutorial 10 Collections Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you enjoy it.

More information

Else. End If End Sub End Class. PDF created with pdffactory trial version

Else. End If End Sub End Class. PDF created with pdffactory trial version Dim a, b, r, m As Single Randomize() a = Fix(Rnd() * 13) b = Fix(Rnd() * 13) Label1.Text = a Label3.Text = b TextBox1.Clear() TextBox1.Focus() Private Sub Button2_Click(ByVal sender As System.Object, ByVal

More information

About this exam review

About this exam review Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review

More information

DroidBasic Syntax Contents

DroidBasic Syntax Contents DroidBasic Syntax Contents DroidBasic Syntax...1 First Edition...3 Conventions Used In This Book / Way Of Writing...3 DroidBasic-Syntax...3 Variable...4 Declaration...4 Dim...4 Public...4 Private...4 Static...4

More information

Unit 3: Multiplication and Division Reference Guide pages x 7 = 392 factors: 56, 7 product 392

Unit 3: Multiplication and Division Reference Guide pages x 7 = 392 factors: 56, 7 product 392 Lesson 1: Multiplying Integers and Decimals, part 1 factor: any two or more numbers multiplied to form a product 56 x 7 = 392 factors: 56, 7 product 392 Integers: all positive and negative whole numbers

More information

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types

Unit 4. Lesson 4.1. Managing Data. Data types. Introduction. Data type. Visual Basic 2008 Data types Managing Data Unit 4 Managing Data Introduction Lesson 4.1 Data types We come across many types of information and data in our daily life. For example, we need to handle data such as name, address, money,

More information

6.1 Evaluate Roots and Rational Exponents

6.1 Evaluate Roots and Rational Exponents VOCABULARY:. Evaluate Roots and Rational Exponents Radical: We know radicals as square roots. But really, radicals can be used to express any root: 0 8, 8, Index: The index tells us exactly what type of

More information

VB FUNCTIONS AND OPERATORS

VB FUNCTIONS AND OPERATORS VB FUNCTIONS AND OPERATORS In der to compute inputs from users and generate results, we need to use various mathematical operats. In Visual Basic, other than the addition (+) and subtraction (-), the symbols

More information

Standard ADTs. Lecture 19 CS2110 Summer 2009

Standard ADTs. Lecture 19 CS2110 Summer 2009 Standard ADTs Lecture 19 CS2110 Summer 2009 Past Java Collections Framework How to use a few interfaces and implementations of abstract data types: Collection List Set Iterator Comparable Comparator 2

More information

1. Introduction to Microsoft Excel

1. Introduction to Microsoft Excel 1. Introduction to Microsoft Excel A spreadsheet is an online version of an accountant's worksheet, which can automatically do most of the calculating for you. You can do budgets, analyze data, or generate

More information

Fundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials

Fundamentals. Fundamentals. Fundamentals. We build up instructions from three types of materials Fundamentals We build up instructions from three types of materials Constants Expressions Fundamentals Constants are just that, they are values that don t change as our macros are executing Fundamentals

More information

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals

VARIABLES. 1. STRINGS Data with letters and/or characters 2. INTEGERS Numbers without decimals 3. FLOATING POINT NUMBERS Numbers with decimals VARIABLES WHAT IS A VARIABLE? A variable is a storage location in the computer s memory, used for holding information while the program is running. The information that is stored in a variable may change,

More information

Déclaration du module

Déclaration du module Déclaration du module Imports System.IO Module ModuleStagiaires Public Structure Stagiaire Private m_code As Long Private m_nom As String Private m_prenom As String Public Property code() As Long Get Return

More information

Function: function procedures and sub procedures share the same characteristics, with

Function: function procedures and sub procedures share the same characteristics, with Function: function procedures and sub procedures share the same characteristics, with one important difference- function procedures return a value (e.g., give a value back) to the caller, whereas sub procedures

More information

Arrays, Strings and Collections

Arrays, Strings and Collections Arrays Arrays can be informally defined as a group of variables containing values of the same type and that in some way or another they are related. An array has a fixed size that is defined before the

More information

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants These notes are available on the IMS1906 Web site http://www.sims.monash.edu.au Tutorial Sheet 4/Week 5 Please

More information

VISUAL BASIC 2005 EXPRESS: NOW PLAYING

VISUAL BASIC 2005 EXPRESS: NOW PLAYING VISUAL BASIC 2005 EXPRESS: NOW PLAYING by Wallace Wang San Francisco ADVANCED DATA STRUCTURES: QUEUES, STACKS, AND HASH TABLES Using a Queue To provide greater flexibility in storing information, Visual

More information

Agenda & Reading. VB.NET Programming. Data Types. COMPSCI 280 S1 Applications Programming. Programming Fundamentals

Agenda & Reading. VB.NET Programming. Data Types. COMPSCI 280 S1 Applications Programming. Programming Fundamentals Agenda & Reading COMPSCI 80 S Applications Programming Programming Fundamentals Data s Agenda: Data s Value s Reference s Constants Literals Enumerations Conversions Implicitly Explicitly Boxing and unboxing

More information

To enter the number in decimals Label 1 To show total. Text:...

To enter the number in decimals Label 1 To show total. Text:... Visual Basic tutorial - currency converter We will use visual studio to create a currency converter where we can convert a UK currency pound to other currencies. This is the interface for the application.

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 8 : Collections Lecture Contents 2 Why collections? What is a collection? Non-generic collections: Array & ArrayList Stack HashTable

More information

DEVELOPING OBJECT ORIENTED APPLICATIONS

DEVELOPING OBJECT ORIENTED APPLICATIONS DEVELOPING OBJECT ORIENTED APPLICATIONS By now, everybody should be comfortable using form controls, their properties, along with methods and events of the form class. In this unit, we discuss creating

More information

OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class

OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class Create a Ball Demo program that uses a Ball class. Use the following UML diagram to create the Ball class: Ball - ballcolor: Color - ballwidth, ballheight:

More information

You will not be tested on JUnit or the Eclipse debugger. The exam does not cover interfaces.

You will not be tested on JUnit or the Eclipse debugger. The exam does not cover interfaces. Com S 227 Fall 2016 Topics and review problems for Exam 2 Thursday, November 10, 6:45 pm Locations, by last name: (same locations as Exam 1) A-C Curtiss 0127, first floor only D-N Hoover 2055 O-Z Troxel

More information

DRAWING AND MOVING IMAGES

DRAWING AND MOVING IMAGES DRAWING AND MOVING IMAGES Moving images and shapes in a Visual Basic application simply requires the user of a Timer that changes the x- and y-positions every time the Timer ticks. In our first example,

More information

Syntax. Table of Contents

Syntax. Table of Contents Syntax Table of Contents First Edition2 Conventions Used In This Book / Way Of Writing..2 KBasic-Syntax..3 Variable.4 Declaration4 Dim4 Public..4 Private.4 Protected.4 Static.4 As..4 Assignment4 User Defined

More information

Access Intermediate

Access Intermediate Access 2010 - Intermediate (103-134) Building Access Databases Notes Quick Links Building Databases Pages AC52 AC56 AC91 AC93 Building Access Tables Pages AC59 AC67 Field Types Pages AC54 AC56 AC267 AC270

More information

EnableBasic. The Enable Basic language. Modified by Admin on Sep 13, Parent page: Scripting Languages

EnableBasic. The Enable Basic language. Modified by Admin on Sep 13, Parent page: Scripting Languages EnableBasic Old Content - visit altium.com/documentation Modified by Admin on Sep 13, 2017 Parent page: Scripting Languages This Enable Basic Reference provides an overview of the structure of scripts

More information

EXAMGOOD QUESTION & ANSWER. Accurate study guides High passing rate! Exam Good provides update free of charge in one year!

EXAMGOOD QUESTION & ANSWER. Accurate study guides High passing rate! Exam Good provides update free of charge in one year! EXAMGOOD QUESTION & ANSWER Exam Good provides update free of charge in one year! Accurate study guides High passing rate! http://www.examgood.com Exam : 70-547(VB) Title : PRO:Design and Develop Web-Basd

More information

Lab 6: Making a program persistent

Lab 6: Making a program persistent Lab 6: Making a program persistent In this lab, you will cover the following topics: Using the windows registry to make parts of the user interface sticky Using serialization to save application data in

More information

Rev Name Date. . Round-off error is the answer to the question How wrong is the rounded answer?

Rev Name Date. . Round-off error is the answer to the question How wrong is the rounded answer? Name Date TI-84+ GC 7 Avoiding Round-off Error in Multiple Calculations Objectives: Recall the meaning of exact and approximate Observe round-off error and learn to avoid it Perform calculations using

More information

cs1114 REVIEW of details test closed laptop period

cs1114 REVIEW of details test closed laptop period python details DOES NOT COVER FUNCTIONS!!! This is a sample of some of the things that you are responsible for do not believe that if you know only the things on this test that they will get an A on any

More information

Herefordshire College of Technology Centre Edexcel BTEC Level 3 Extended Diploma in Information Technology (Assignment 1 of 3)

Herefordshire College of Technology Centre Edexcel BTEC Level 3 Extended Diploma in Information Technology (Assignment 1 of 3) Student: Candidate Number: Assessor: Len Shand Herefordshire College of Technology Centre 24150 Edexcel BTEC Level 3 Extended Diploma in Information Technology (Assignment 1 of 3) Course: Unit: Title:

More information

CSE 142 Su 04 Computer Programming 1 - Java. Objects

CSE 142 Su 04 Computer Programming 1 - Java. Objects Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request

More information

Problem One: Loops and ASCII Graphics

Problem One: Loops and ASCII Graphics Problem One: Loops and ASCII Graphics Write a program that prompts the user for a number between 1 and 9, inclusive, then prints a square of text to the console that looks like this: 1**** 22*** 333**

More information

Using Custom Number Formats

Using Custom Number Formats APPENDIX B Using Custom Number Formats Although Excel provides a good variety of built-in number formats, you may find that none of these suits your needs. This appendix describes how to create custom

More information

1. Create your First VB.Net Program Hello World

1. Create your First VB.Net Program Hello World 1. Create your First VB.Net Program Hello World 1. Open Microsoft Visual Studio and start a new project by select File New Project. 2. Select Windows Forms Application and name it as HelloWorld. Copyright

More information

You must bring your ID to the exam.

You must bring your ID to the exam. Com S 227 Spring 2017 Topics and review problems for Exam 2 Monday, April 3, 6:45 pm Locations, by last name: (same locations as Exam 1) A-E Coover 2245 F-M Hoover 2055 N-S Physics 0005 T-Z Hoover 1213

More information

CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration. MIS 15 Introduction to Business Programming. Programming Assignment 3 (P3)

CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration. MIS 15 Introduction to Business Programming. Programming Assignment 3 (P3) CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration MIS 15 Introduction to Business Programming Programming Assignment 3 (P3) Points: 50 Due Date: Tuesday, May 10 The purpose of

More information

CSE 373: Data Structures and Algorithms

CSE 373: Data Structures and Algorithms CSE 373: Data Structures and Algorithms Lecture 19: Comparison Sorting Algorithms Instructor: Lilian de Greef Quarter: Summer 2017 Today Intro to sorting Comparison sorting Insertion Sort Selection Sort

More information

Computer Science 9608 (Notes) Chapter: 4.1 Computational thinking and problem-solving

Computer Science 9608 (Notes) Chapter: 4.1 Computational thinking and problem-solving In Computer Science, an abstract data type (ADT) is a mathematical model for a certain data type or structures. This doesn t mean that the ADTs cannot be programmed. But that we must first understand them

More information

ONLINE BOOKING GUIDE

ONLINE BOOKING GUIDE ONLINE BOOKING GUIDE Table of Contents OVERVIEW & LOGGING IN... 2 SET UP & EDIT YOUR PROFILE... 4 BOOKING PREFERENCES TENNIS... 5 TENNIS BOOKINGS... 6 MAKE A BOOKING TENNIS... 6 MAKE A BOOKING SQUASH...

More information

IRESS Depth - Web Services Version 4 Walkthrough Visual Basic 2008 sample to retrieve IRESS Depth information

IRESS Depth - Web Services Version 4 Walkthrough Visual Basic 2008 sample to retrieve IRESS Depth information IRESS Depth - Web Services Version 4 Walkthrough Visual Basic 2008 sample to retrieve IRESS Depth information The purpose of this walkthrough is to build the following Windows Forms Application that will

More information

IOS Plus Trade - Web Services Version 4 Walkthrough

IOS Plus Trade - Web Services Version 4 Walkthrough IOS Plus Trade - Web Services Version 4 Walkthrough Visual Basic 2008 sample to retrieve IOS Plus Trade information The purpose of this walkthrough is to build the following Windows Forms Application that

More information

Module 4: Data Types and Variables

Module 4: Data Types and Variables Module 4: Data Types and Variables Table of Contents Module Overview 4-1 Lesson 1: Introduction to Data Types 4-2 Lesson 2: Defining and Using Variables 4-10 Lab:Variables and Constants 4-26 Lesson 3:

More information

Week 6. Data structures

Week 6. Data structures 1 2 3 4 5 n Week 6 Data structures 6 7 n 8 General remarks We start considering Part III Data Structures from CLRS. As a first example we consider two special of buffers, namely stacks and queues. Reading

More information

Chapter 2.4: Common facilities of procedural languages

Chapter 2.4: Common facilities of procedural languages Chapter 2.4: Common facilities of procedural languages 2.4 (a) Understand and use assignment statements. Assignment An assignment is an instruction in a program that places a value into a specified variable.

More information

Data Structures and Algorithms in Java. Second Year Software Engineering

Data Structures and Algorithms in Java. Second Year Software Engineering Data Structures and Algorithms in Java Second Year Software Engineering Introduction Computer: is a programmable machine that can store, retrieve and process data. Data: The representation of information

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 7 : Collections Lecture Contents 2 Why collections? What is a collection? Non-generic collections: Array & ArrayList Stack HashTable

More information

Excel VBA Variables, Data Types & Constant

Excel VBA Variables, Data Types & Constant Excel VBA Variables, Data Types & Constant Variables are used in almost all computer program and VBA is no different. It's a good practice to declare a variable at the beginning of the procedure. It is

More information

CSE373 Winter 2014, Final Examination March 18, 2014 Please do not turn the page until the bell rings.

CSE373 Winter 2014, Final Examination March 18, 2014 Please do not turn the page until the bell rings. CSE373 Winter 2014, Final Examination March 18, 2014 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note, closed calculator, closed electronics. Please stop promptly

More information

C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions

C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions Between the comments included with the code and the code itself, you shouldn t have any problems understanding what

More information

Python Lists, Tuples, Dictionaries, and Loops

Python Lists, Tuples, Dictionaries, and Loops Python Lists, Tuples, Dictionaries, and Loops What you need to Know For this lecture you need to know: 1. How to write and run basic python programs 2. How to create and assign data to variables 3. How

More information

Review. October 20, 2006

Review. October 20, 2006 Review October 20, 2006 1 A Gentle Introduction to Programming A Program (aka project, application, solution) At a very general level there are 3 steps to program development Determine output Determine

More information

CS112 Lecture: Working with Numbers

CS112 Lecture: Working with Numbers CS112 Lecture: Working with Numbers Last revised January 30, 2008 Objectives: 1. To introduce arithmetic operators and expressions 2. To expand on accessor methods 3. To expand on variables, declarations

More information

Introduction. In this preliminary chapter, we introduce a couple of topics we ll be using DEVELOPING CLASSES

Introduction. In this preliminary chapter, we introduce a couple of topics we ll be using DEVELOPING CLASSES Introduction In this preliminary chapter, we introduce a couple of topics we ll be using throughout the book. First, we discuss how to use classes and object-oriented programming (OOP) to aid in the development

More information

7. Inheritance & Polymorphism. Not reinventing the wheel

7. Inheritance & Polymorphism. Not reinventing the wheel 7. Inheritance & Polymorphism Not reinventing the wheel Overview Code Inheritance Encapsulation control Abstract Classes Shared Members Interface Inheritance Strongly Typed Data Structures Polymorphism

More information

FUNDAMENTAL ARITHMETIC

FUNDAMENTAL ARITHMETIC FUNDAMENTAL ARITHMETIC Prime Numbers Prime numbers are any whole numbers greater than that can only be divided by and itself. Below is the list of all prime numbers between and 00: Prime Factorization

More information

Sébastien Mathier wwwexcel-pratiquecom/en Variables : Variables make it possible to store all sorts of information Here's the first example : 'Display the value of the variable in a dialog box 'Declaring

More information

Repetition Structures

Repetition Structures Repetition Structures There are three main structures used in programming: sequential, decision and repetition structures. Sequential structures follow one line of code after another. Decision structures

More information

Getting Information from a Table

Getting Information from a Table ch02.fm Page 45 Wednesday, April 14, 1999 2:44 PM Chapter 2 Getting Information from a Table This chapter explains the basic technique of getting the information you want from a table when you do not want

More information

Fun facts about recursion

Fun facts about recursion Outline examples of recursion principles of recursion review: recursive linked list methods binary search more examples of recursion problem solving using recursion 1 Fun facts about recursion every loop

More information

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012

MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 MARKING KEY The University of British Columbia MARKING KEY Computer Science 260 Midterm #2 Examination 12:30 noon, Thursday, March 15, 2012 Instructor: K. S. Booth Time: 70 minutes (one hour ten minutes)

More information

General Instructions. You can use QtSpim simulator to work on these assignments.

General Instructions. You can use QtSpim simulator to work on these assignments. General Instructions You can use QtSpim simulator to work on these assignments. Only one member of each group has to submit the assignment. Please Make sure that there is no duplicate submission from your

More information

COMP 103 Introduction to Data Structures and Algorithms

COMP 103 Introduction to Data Structures and Algorithms T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Student ID:..................... EXAMINATIONS 2005 END-YEAR COMP 103 Introduction to Data

More information

27/04/2012. Objectives. Collection. Collections Framework. "Collection" Interface. Collection algorithm. Legacy collection

27/04/2012. Objectives. Collection. Collections Framework. Collection Interface. Collection algorithm. Legacy collection Objectives Collection Collections Framework Concrete collections Collection algorithm By Võ Văn Hải Faculty of Information Technologies Summer 2012 Legacy collection 1 2 2/27 Collections Framework "Collection"

More information

EXAM Computer Science 1 Part 1

EXAM Computer Science 1 Part 1 Maastricht University Faculty of Humanities and Science Department of Knowledge Engineering EXAM Computer Science 1 Part 1 Block 1.1: Computer Science 1 Code: KEN1120 Examiner: Kurt Driessens Date: Januari

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

CS Introduction to Data Structures How to Parse Arithmetic Expressions

CS Introduction to Data Structures How to Parse Arithmetic Expressions CS3901 - Introduction to Data Structures How to Parse Arithmetic Expressions Lt Col Joel Young One of the common task required in implementing programming languages, calculators, simulation systems, and

More information

Variable A variable is a value that can change during the execution of a program.

Variable A variable is a value that can change during the execution of a program. Declare and use variables and constants Variable A variable is a value that can change during the execution of a program. Constant A constant is a value that is set when the program initializes and does

More information

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6)

DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) Technology & Information Management Instructor: Michael Kremer, Ph.D. Database Program: Microsoft Access Series DATABASE AUTOMATION USING VBA (ADVANCED MICROSOFT ACCESS, X405.6) AGENDA 3. Executing VBA

More information

CSE373 Fall 2013, Second Midterm Examination November 15, 2013

CSE373 Fall 2013, Second Midterm Examination November 15, 2013 CSE373 Fall 2013, Second Midterm Examination November 15, 2013 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note, closed calculator, closed electronics. Please

More information

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines. Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

More information

Burrows & Langford Chapter 10 page 1 Learning Programming Using VISUAL BASIC.NET

Burrows & Langford Chapter 10 page 1 Learning Programming Using VISUAL BASIC.NET Burrows & Langford Chapter 10 page 1 CHAPTER 10 WORKING WITH ARRAYS AND COLLECTIONS Imagine a mail-order company that sells products to customers from all 50 states in the United States. This company is

More information

CS 101 Spring 2006 Final Exam Name: ID:

CS 101 Spring 2006 Final Exam Name:  ID: This exam is open text book but closed-notes, closed-calculator, closed-neighbor, etc. Unlike the midterm exams, you have a full 3 hours to work on this exam. Please sign the honor pledge here: Page 1

More information

CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output

CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output CS112 Lecture: Variables, Expressions, Computation, Constants, Numeric Input-Output Last revised January 12, 2006 Objectives: 1. To introduce arithmetic operators and expressions 2. To introduce variables

More information

Language Fundamentals

Language Fundamentals Language Fundamentals VBA Concepts Sept. 2013 CEE 3804 Faculty Language Fundamentals 1. Statements 2. Data Types 3. Variables and Constants 4. Functions 5. Subroutines Data Types 1. Numeric Integer Long

More information

Exponential Numbers ID1050 Quantitative & Qualitative Reasoning

Exponential Numbers ID1050 Quantitative & Qualitative Reasoning Exponential Numbers ID1050 Quantitative & Qualitative Reasoning In what ways can you have $2000? Just like fractions, you can have a number in some denomination Number Denomination Mantissa Power of 10

More information

Data Structures - CSCI 102. CS102 Hash Tables. Prof. Tejada. Copyright Sheila Tejada

Data Structures - CSCI 102. CS102 Hash Tables. Prof. Tejada. Copyright Sheila Tejada CS102 Hash Tables Prof. Tejada 1 Vectors, Linked Lists, Stack, Queues, Deques Can t provide fast insertion/removal and fast lookup at the same time The Limitations of Data Structure Binary Search Trees,

More information

Running the Altair SIMH from.net programs

Running the Altair SIMH from.net programs Running the Altair SIMH from.net programs The Altair SIMH simulator can emulate a wide range of computers and one of its very useful features is that it can emulate a machine running 50 to 100 times faster

More information

Introduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.

Introduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4. Introduction to Visual Basic and Visual C++ Arithmetic Expression Lesson 4 Calculation I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Arithmetic Expression Using Arithmetic Expression Calculations

More information

Expressing Decimal Numbers in Word Form

Expressing Decimal Numbers in Word Form Expressing Decimal Numbers in Word Form Sep 27 10:17 PM 1 When reading decimal numbers, the decimal can be expressed by saying decimal, point or and. Example: A) 307 518.537 Three hundred seven thousand

More information

EXAMINATIONS 2005 END-YEAR. COMP 103 Introduction to Data Structures and Algorithms

EXAMINATIONS 2005 END-YEAR. COMP 103 Introduction to Data Structures and Algorithms T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I ÎÍÏ V I C T O R I A UNIVERSITY OF WELLINGTON EXAMINATIONS 2005 END-YEAR COMP 103 Introduction to Data Structures and Algorithms Time Allowed:

More information

An overview about DroidBasic For Android

An overview about DroidBasic For Android An overview about DroidBasic For Android from February 25, 2013 Contents An overview about DroidBasic For Android...1 Object-Oriented...2 Event-Driven...2 DroidBasic Framework...2 The Integrated Development

More information

Learning VB.Net. Tutorial 16 Modules

Learning VB.Net. Tutorial 16 Modules Learning VB.Net Tutorial 16 Modules Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you enjoy it. If

More information

How to Validate DataGridView Input

How to Validate DataGridView Input How to Validate DataGridView Input This example explains how to use DR.net to set validation criteria for a DataGridView control on a Visual Studio.NET form. Why You Should Use This To add extensible and

More information

Data Structures and Algorithms 2018

Data Structures and Algorithms 2018 Question 1 (12 marks) Data Structures and Algorithms 2018 Assignment 4 25% of Continuous Assessment Mark Deadline : 5pm Monday 12 th March, via Canvas Sort the array [5, 3, 4, 6, 8, 4, 1, 9, 7, 1, 2] using

More information

PROGRAMMING ASSIGNMENT: MOVIE QUIZ

PROGRAMMING ASSIGNMENT: MOVIE QUIZ PROGRAMMING ASSIGNMENT: MOVIE QUIZ For this assignment you will be responsible for creating a Movie Quiz application that tests the user s of movies. Your program will require two arrays: one that stores

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 8 : Collections Lecture Contents 2 Why collections? What is a collection? Non-generic collections: Array & ArrayList Stack HashTable

More information

MATFOR In Visual Basic

MATFOR In Visual Basic Quick Start t t MATFOR In Visual Basic ANCAD INCORPORATED TEL: +886(2) 8923-5411 FAX: +886(2) 2928-9364 support@ancad.com www.ancad.com 2 MATFOR QUICK START Information in this instruction manual is subject

More information

TREES 11/1/18. Prelim Updates. Data Structures. Example Data Structures. Tree Overview. Tree. Singly linked list: Today: trees!

TREES 11/1/18. Prelim Updates. Data Structures. Example Data Structures. Tree Overview. Tree. Singly linked list: Today: trees! relim Updates Regrades are live until next Thursday @ :9M A few rubric changes are happening Recursion question: -0pts if you continued to print Exception handling write the output of execution of that

More information

Department of Computer Science Admission Test for PhD Program. Part I Time : 30 min Max Marks: 15

Department of Computer Science Admission Test for PhD Program. Part I Time : 30 min Max Marks: 15 Department of Computer Science Admission Test for PhD Program Part I Time : 30 min Max Marks: 15 Each Q carries 1 marks. ¼ mark will be deducted for every wrong answer. Part II of only those candidates

More information

PLT Fall Shoo. Language Reference Manual

PLT Fall Shoo. Language Reference Manual PLT Fall 2018 Shoo Language Reference Manual Claire Adams (cba2126) Samurdha Jayasinghe (sj2564) Rebekah Kim (rmk2160) Cindy Le (xl2738) Crystal Ren (cr2833) October 14, 2018 Contents 1 Comments 2 1.1

More information