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

Similar documents
Learning VB.Net. Tutorial 10 Collections

FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources

Learning VB.Net. Tutorial 19 Classes and Inheritance

Objectives. After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism

A Complete Tutorial for Beginners LIEW VOON KIONG

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

VISUAL BASIC II CC111 INTRODUCTION TO COMPUTERS

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

Mr.Khaled Anwar ( )

โปรแกรมช วยทดสอบหม อแปลงกระแส

Learning VB.Net. Tutorial 15 Structures

Learning VB.Net. Tutorial 17 Classes

S.2 Computer Literacy Question-Answer Book

DO NOT COPY AMIT PHOTOSTUDIO

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

Chapter 2 Exploration of a Visual Basic.Net Application

Programming with Visual Studio Higher (v. 2013)

Revision for Final Examination (Second Semester) Grade 9

1. Create your First VB.Net Program Hello World

Disclaimer. Trademarks. Liability

IT3101 -Rapid Application Development Second Year- First Semester. Practical 01. Visual Basic.NET Environment.

Lab 3 The High-Low Game

IT 1033: Fundamentals of Programming Loops

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

Outline. Example: Entertaining Friends. Modular Programming. Example: Entertaining Friends. Example: Entertaining Friends. Lecture 1.

VISUAL BASIC PROGRAMMING (44) Technical Task KEY. Regional 2013 TOTAL POINTS (485)

Unit 7. Lesson 7.1. Loop. For Next Statements. Introduction. Loop

C16 Visual Basic Net Programming

DEVELOPING OBJECT ORIENTED APPLICATIONS

Lecture 10 OOP and VB.Net

Year 12 : Visual Basic Tutorial.

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

I101/B100 Problem Solving with Computers

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

Tutorial 03 understanding controls : buttons, text boxes

PROGRAMMING ASSIGNMENT: MOVIE QUIZ

Visual Studio.NET for AutoCAD Programmers

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

Computing Science Unit 1

Private Sub Cours_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Lab 4: Adding a Windows User-Interface

超音波モータ制御プログラムの作成 (v1.2.1)

Level 3 Computing Year 2 Lecturer: Phil Smith

Senior Software Engineering Project CSSP Project CEN April 5, Adam Cox Tass Oscar

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Text = Label1.

DRAWING AND MOVING IMAGES

A Second Visual BASIC Application : Greetings

Part 4 - Procedures and Functions

CS708 Lecture Notes. Visual Basic.NET Object-Oriented Programming. Implementing Client/Server Architectures. Part (I of?) (Lecture Notes 5A)

Program Example 15 String Handling 2

MATFOR In Visual Basic

Decision Structures. Start. Do I have a test in morning? Study for test. Watch TV tonight. Stop

The New Brew-CQ Synchronous Sockets and Threading

(0,0) (600, 400) CS109. PictureBox and Timer Controls

Connection Example. Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date :

Disclaimer. Trademarks. Liability

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

Learning VB.Net. Tutorial 16 Modules

Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date :

Visual Basic.NET. 1. Which language is not a true object-oriented programming language?

Visual Basic: Opdracht Structuur

Running the Altair SIMH from.net programs

Visual Web Development

IF ELSE and the Loops like For..NEXT, While..END WHILE are the Control Statements. 5. Write a Simple program to explain the FOR EACH loop in VB.

フラクタル 1 ( ジュリア集合 ) 解説 : ジュリア集合 ( 自己平方フラクタル ) 入力パラメータの例 ( 小さな数値の変化で模様が大きく変化します. Ar や Ai の数値を少しずつ変化させて描画する. ) プログラムコード. 2010, AGU, M.

How to Validate DataGridView Input

"!#... )*! "!# )+, -./ 01 $

Final Exam 7:00-10:00pm, April 14, 2008

Apéndice E Código de software de ayuda en Visual Basic 2005 Public Class Form1

Code: Week 13. Write a Program to perform Money Conversion. Public Class Form1

BSc (Hons) Computer Science with. Network Security. BSc (Hons) Business Information Systems. Examinations for 2018 / Semester 1

Lab 6: Making a program persistent

ก Microsoft Visual Studio 2008

Interacting with External Applications

: CREATING WEB BASED APPLICATIONS FOR INSTRUMENT DATA TRANSFER USING VISUAL STUDIO.NET

GUI Design and Event- Driven Programming

COPYRIGHTED MATERIAL. Taking Web Services for a Test Drive. Chapter 1. What s a Web Service?

Pointers, Arrays and Parameters

This PDF was generated in real-time using DynamicPDF; Generator for.net.

Programming Logic Beginning

Form Connection. Imports System Imports System.Threading Imports System.IO.Ports Imports System.ComponentModel

Déclaration du module

Check out the demo video of this application so you know what you will be making in this tutorial.

Programming Logic - Beginning

This PDF was generated in real-time using DynamicPDF; Generator for.net.

Serial-out Color Sensor. Overview. Features

VB.NET Programs. ADO.NET (insert, update, view records)

Instructor s Notes Programming Logic Printing Reports. Programming Logic. Printing Custom Reports

Review. October 20, 2006

CSE 123 Introduction to Computing

Microsoft Visual Basic 2005: Reloaded

NATIONAL CERTIFICATE (VOCATIONAL) PRINCIPLES OF COMPUTER PROGRAMMING (Second Paper: Practical) NQF LEVEL 3 NOVEMBER 2009

How to work with data sources and datasets

The Number Plane THE NUMBER PLANE PASSPORT.

1 Dept: CE.NET Programming ( ) Prof. Akash N. Siddhpura. Working with Form: properties, methods and events

Developing Student Programming and Problem-Solving Skills With Visual Basic

Database Tutorials

Activating AspxCodeGen 4.0

10/17/2011. Object Oriented Software Development. Types of interface. Interfaces example

Java Assignment (BCA/BE Computer)

Transcription:

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 contact your tutor if you require assistance with these exercises. Tutor email address and consultation times are available on the subject s Web page under Staff. Aim To understand the purpose of variables and datatypes To understand and use symbolic constants and literals in programs To write VB.NET code that uses local and module level variables To understand the purpose of an InputBox and MessageBox.Show To be able to create your own InputBox and MessageBox Exercise 1 (Should be completed before the class) (30mins for tutor assistance) a) Explain what is meant by Option Explicit On and Option Strict On when writing VB.NET programs. b) State the most suitable VB.NET datatype for each of the following: i) daily rainfall ii) iii) iv) a person s name if you belong to a sport s club a mobile number c) A part-time waitress earns a salary based on the number of hours she works, and is paid at a fixed rate. Given the expression below that calculates the waitress's net salary: Salary =.75 x fixed hourly rate x hours worked Identify any literal constants, symbolic constants and variables.

Exercise 2 (30mins) Figure 1- User Interface to swap values a) Draw a TOE chart for the above user interface. b) Design a similar user interface to that given in Figure 1, but which follows Window s GUI standards. c) Write VB.NET code behind the Exit and Clear command buttons. Insert inline documentation. d) Write code behind the swap button that swaps integers. Remember to turn Option Explicit On and Option Strict On. e) Modify the code so that it can swap names. f) Modify the code so that it can swap single values. NOTE: You will need to use the Convert Class.

Figure 2 User Interface Exercise 3 -Variables and Constants; local, module-level (30mins) a) Design a similar user interface to that given in Figure 2, but which follows Window s GUI standards. b) Name the buttons, btnexit, btnclear, btnarea, btnperim c) Write the VB.NET code behind the Exit and Clear buttons. d) Write the code behind the Area button to computes the area of a circle A= pi * r^2. Insert inline documentation and test it. [Remember to use Math.PI] e) Identify any local variables, symbolic constants and literal constants that are used. List their names and purpose. f) Write the code behind the Perimeter button. Insert inline documentation and test it.

Exercise 4: Consider the following program written in VB.NET and then answer the questions that follow on the next page. (30 minutes) Public Class Form1 Inherits System.Windows.Forms.Form Dim secret As String Dim counter As Integer = 0 Private Sub Form1_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles MyBase.Load secret = "Apple" Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click secret = "Frog" counter = counter + 1 Private Sub Blah(ByVal a As Integer) Dim secret As String secret = "House" a = a * 2 Private Sub Button2_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button2.Click Dim magic_number As Integer = 9 magic_number = magic_number + 1 counter = counter + 1 ListBox1.Items.Add(secret + ", " + _ magic_number.tostring()) If counter >= 3 Then Blah(magic_number) counter = 0 End If End Class Image showing the layout of controls for the program:

a) Write the total contents of the Listbox after the buttons have been clicked in the following order: Button2, Button2, Button1, Button2, Button1, Button2 b) What type of scope does the variable counter have? c) What type of scope does the variable magic_number have? d) Upon conclusion of the Blah sub procedure for the first time, what value is stored in a? How come this is the value stored in a at that point? What is the value of counter after completing the above clicking sequence?