OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class

Size: px
Start display at page:

Download "OVERLOADING METHODS AND CONSTRUCTORS: The Ball Class"

Transcription

1 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: Integer - mybrush: SolidBrush - xpos, ypos: Integer New() New(xPos: Integer, ypos: Integer) New(xPos: Integer, ypos: Integer, width: Integer, height: Integer) + Color(col: Color): Color + DrawBall(g: Graphics) + Height(bHeight: Integer): Integer + Move() + Move(xPixels: Integer, ypixels: Integer) + Width(bWidth: Integer): Integer + X(ballX: Integer): Integer + Y(ballY: Integer): Integer The Ball class will be responsible for knowing its own location (i.e. x- and y-position), its dimensions, and its colour. We are going to implement this responsibility by providing the Ball class with variables that will store each of these values. We are going to declare the variables as follows: Public Class Ball Private mybrush As SolidBrush Private col As Color Private xpos, ypos As Integer Private ballwidth, ballheight As Integer End Class IMPLEMENTING CONSTRUCTORS We are going to create a constructor that does not take any parameters and initializes our class fields or variables with default values. It s going to look something like this: The Ball Class Page 1 of 9

2 Public Sub New() col = Color.Blue mybrush = New SolidBrush(col) xpos = 0 ypos = 0 ballwidth = 30 ballheight = 30 Since we are using a no-arg constructor for the Ball class and no parameters are being passed to the constructor, we need to assign default values for the Ball object that will be created. In the above example, we are going to set the x- and y-position of the ball at 0, 0, set the dimension to 30 x 30, and set the colour to blue. Now we can create our Ball object in our program by writing the following lines of code in our Ball Demo program: Public Class BallDemo Private g As Graphics Private myball As Ball Private Sub BallDemo_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load g = Me.CreateGraphics() myball = New Ball Private Sub BallDemo_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint myball.drawball(g) End Class Before we can run the program, we need to create a method called DrawBall() because this is where we will be writing the code to draw our Ball object onto the form. In order to draw the ball, however, we need the Graphics object that is being used in the program. So our DrawBall() method in the Ball class would look like this: The Ball Class Page 2 of 9

3 Public Sub DrawBall(ByVal g As Graphics) g.fillellipse(mybrush, xpos, ypos, ballwidth, ballheight) The responsibility of drawing the Ball object should fall on the Ball class because we the information required to draw the ball is in the class itself, not the program. However, in order to draw the Ball object, the class needs the Graphics object that is being used in the program. This is why the Graphics object needs to be passed to the DrawBall() method. When you run the program, you should see a Ball object at the top-left corner of the form: OVERLOADING CONSTRUCTORS One way to overload the constructor and provide more flexibility to the Ball class is to allow the user the ability to indicate where to position the ball when it s created. So we can create a second constructor that allows the user to pass two integers representing the x- and y-positions where they may want the ball to initially be positioned: Public Sub New(ByVal x As Integer, ByVal y As Integer) xpos = x ypos = y ballwidth = 30 ballheight = 30 col = Color.Blue mybrush = New SolidBrush(col) The Ball Class Page 3 of 9

4 When you initialize a Ball object using this constructor, you will need to pass the x-position and the y- position of the ball. So now we can create a Ball object in our program as follows: Public Class BallDemo Private myball As Ball Private Sub BallDemo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load myball = New Ball(100, 200) End Class Let s create a third constructor that allows the user to specify the location of the Ball object and its dimensions. The constructor would look something like this: Public Sub New(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer) xpos = x ypos = y ballwidth = width ballheight = height col = Color.Blue mybrush = New SolidBrush(col) IMPLEMENTING PROPERTIES Now that we have our class variables and constructors in place, it s time to create properties for our Ball class. Public Property X As Integer 'This property will set and return the x-position of the Ball Public Property Y As Integer The Ball Class Page 4 of 9

5 'This property will set and return the y-position of the Ball Public Property Color As Color 'This property will set and return the color of the Ball Public Property Width As Integer 'This property will set and return the width of the Ball Public Property Height As Integer 'This property will set and return the height of the Ball IMPLEMENTING METHODS Now let s add a method that will make the ball move. We will simply call the method Move(). Public Sub Move() xpos += 5 ypos += 3 The purpose of the Move() method is to move the x- and y-position of the ball object a specific number of pixels. In our example, we are going to increase the x-position of the ball by 5 pixels and increase the y-position of the ball by 3 pixels. OVERLOADING METHODS Let s create a second Move() method that allows programmers to specify how many pixels along the x- and y-axis to move the ball. The Ball Class Page 5 of 9

6 Public Shadows Sub Move(ByVal xpixels As Integer, ByVal ypixels As Integer) xpos += xpixels ypos += ypixels USING THE Ball CLASS IN A PROGRAM Now that we have factored all of the responsibility for the Ball out of the program itself, we can use the Ball class within our Ball Demo program. We will start by declaring an instance of the Ball as a member of our program: Public Class BallDemo Private g As Graphics Private myball As Ball Private Sub BallDemo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load g = Me.CreateGraphics() myball = New Ball(0, 0, 50, 50) Private Sub DrawingImages_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint myball.drawball(g) Private Sub tmrball_tick(byval sender As System.Object, ByVal e As System.EventArgs) Handles tmrball.tick myball.move() Me.Refresh() The Ball Class Page 6 of 9

7 Private Sub btnstart_click(byval sender As System.Object, ByVal e As System.EventArgs) Handles btnstart.click If btnstart.text = "START" Then btnstart.text = "STOP" tmrball.start() Else btnstart.text = "START" tmrball.stop() End If End Class When the program launches and you click the START button, the ball will start moving horizontally to the right and vertically to the bottom of the screen. The problem, of course, is that the ball is going to eventually disappear from the screen. To solve this problem, we will need to first create two variables that will keep track of the direction along the x-axis and the direction along the y-axis that the ball will be travelling. Create two variables in your program that will keep track of the direction the ball will be traveling: Private xdir, ydir As Integer Set the variables to a default value of your choice. I will set the x-direction and y-direction to 4 and 3 respectively when the program loads: Private Sub BallDemo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load myball = New Ball(0, 0, 50, 50) The Ball Class Page 7 of 9

8 xdir = 5 ydir = 3 Next, we will need to add code that will check if the ball has banged into any of the walls (top, bottom, left or right). In order to do this, we will need to write the code inside the timer s Tick procedure as follows: Private Sub tmrball_tick(byval sender As System.Object, ByVal e As System.EventArgs) Handles tmrball.tick myball.move(xdir, ydir) 'Check if the ball hits the left or right wall If myball.x + myball.width >= Me.Width - 20 Or myball.x <= 0 Then xdir = -xdir End If 'Check if the ball hits the top or bottom wall If myball.y <= 0 Or myball.y + myball.height >= Me.Height - 40 Then ydir = -ydir End If Now when you run the program, the ball will check if it hits any of the four walls and reverse its position accordingly. When checking if the ball reaches the right wall, we need to get the x-position of the ball and add the width because we want to check if the right side of the ball hits the wall. If we didn t add the width, we would be checking if the left side of the ball hits the wall. xpos xpos + width When checking if the ball reaches the bottom wall, we need to do the same thing we did when checking if the ball hits the right wall with the only difference being that we need to use the y-position of the ball and the height of the panel. The Ball Class Page 8 of 9

9 ypos ypos + height The Ball Class Page 9 of 9

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

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

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

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

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

More information

ICS 4U. Introduction to Programming in Java. Chapter 10 Notes

ICS 4U. Introduction to Programming in Java. Chapter 10 Notes ICS 4U Introduction to Programming in Java Chapter 10 Notes Classes and Inheritance In Java all programs are classes, but not all classes are programs. A standalone application is a class that contains

More information

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

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

Chapter 13. Graphics, Animation, Sound, and Drag-and-Drop. McGraw-Hill. Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved.

Chapter 13. Graphics, Animation, Sound, and Drag-and-Drop. McGraw-Hill. Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. Chapter 13 Graphics, Animation, Sound, and Drag-and-Drop McGraw-Hill Copyright 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. Objectives (1 of 2) Use Graphics methods to draw shapes, lines,

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

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

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

Lab 8. An Introduction to Objects

Lab 8. An Introduction to Objects Lab 8 An Introduction to Objects 1 Overview One of the characteristics, perhaps the most important, of a good designer is the ability to deal with abstractions or generalizations. In the process of learning

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

Name CMPS 5J Final March 17, 2009 This is a closed notes, closed book exam.

Name CMPS 5J Final March 17, 2009 This is a closed notes, closed book exam. Name CMPS 5J Final March 17, 2009 This is a closed notes, closed book exam. There are 21 problems and 50 points total. The last 5 problems ask you to write short programs or code fragments. There are multiple

More information

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

Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date : Form Adapter Example DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date : 2009-06-19 Form_Adapter.doc DRAFT page 1 Table of Contents Creating Form_Adapter.vb... 2 Adding the

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

My first game. 'function which adds objects with bug tag to bugarray array. Saturday, November 23, :06 AM

My first game. 'function which adds objects with bug tag to bugarray array. Saturday, November 23, :06 AM My first game Saturday, November 23, 2013 5:06 AM Public Class Form1 Dim moveright As Boolean = False Dim moveup As Boolean = False Dim moveleft As Boolean = False Dim movedown As Boolean = False Dim score

More information

A Second Visual BASIC Application : Greetings

A Second Visual BASIC Application : Greetings The Greetings Program A Second Visual BASIC Application : Greetings The following instructions take you through the steps to create a simple application. A greeting is displayed in one of four different

More information

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

(0,0) (600, 400) CS109. PictureBox and Timer Controls CS109 PictureBox and Timer Controls Let s take a little diversion and discuss how to draw some simple graphics. Graphics are not covered in the book, so you ll have to use these notes (or the built-in

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

Public Class ClassName (naming: CPoint)

Public Class ClassName (naming: CPoint) Lecture 6 Object Orientation Class Implementation Concepts: Encapsulation Inheritance Polymorphism Template/Syntax: Public Class ClassName (naming: CPoint) End Class Elements of the class: Data 1. Internal

More information

Recall that creating or declaring a variable can be done as follows:

Recall that creating or declaring a variable can be done as follows: Lesson 2: & Conditionals Recall that creating or declaring a variable can be done as follows:! float radius = 20;! int counter = 5;! string name = Mr. Nickel ;! boolean ispressed = true;! char grade =

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

UNIT 1: PROGRAMMING ENVIRONMENT

UNIT 1: PROGRAMMING ENVIRONMENT UNIT 1: PROGRAMMING ENVIRONMENT 1.1 Introduction This unit introduces the programming environment for the Basic Digital Signal Processing course. It gives a brief description of the Visual Basic classes

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

Name CMPS 5J Final March 17, 2010 This is a closed notes, closed book exam. Each problem is worth 1 point unless indicated otherwise.

Name CMPS 5J Final March 17, 2010 This is a closed notes, closed book exam. Each problem is worth 1 point unless indicated otherwise. Name CMPS 5J Final March 17, 2010 This is a closed notes, closed book exam. Each problem is worth 1 point unless indicated otherwise. There are 21 problems and 25 points total. There are multiple versions

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

PyGame Sprites. an excellent turorial exists for PyGame sprites here kai.vm.bytemark.co.uk/ piman/writing/spritetutorial.shtml.

PyGame Sprites. an excellent turorial exists for PyGame sprites here  kai.vm.bytemark.co.uk/ piman/writing/spritetutorial.shtml. PyGame Sprites slide 1 an excellent turorial exists for PyGame sprites here http:// kai.vm.bytemark.co.uk/ piman/writing/spritetutorial.shtml. these notes are derived from this tutorial and the examples

More information

INTRODUCTION TO MATLAB INTERACTIVE GRAPHICS EXERCISES

INTRODUCTION TO MATLAB INTERACTIVE GRAPHICS EXERCISES INTRODUCTION TO MATLAB INTERACTIVE GRAPHICS EXERCISES Eric Peasley, Department of Engineering Science, University of Oxford version 3.0, 2017 MATLAB Interactive Graphics Exercises In these exercises you

More information

Tutorial 03 understanding controls : buttons, text boxes

Tutorial 03 understanding controls : buttons, text boxes Learning VB.Net Tutorial 03 understanding controls : buttons, text boxes Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple

More information

Visual C# Program: Simple Game 3

Visual C# Program: Simple Game 3 C h a p t e r 6C Visual C# Program: Simple Game 3 In this chapter, you will learn how to use the following Visual C# Application functions to World Class standards: Opening Visual C# Editor Beginning a

More information

Section 7 The BASIC Language II

Section 7 The BASIC Language II 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

More information

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

FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources This application demonstrates how a DataGridView control can be

More information

Create a memory DC for double buffering

Create a memory DC for double buffering Animation Animation is implemented as follows: Create a memory DC for double buffering Every so many milliseconds, update the image in the memory DC to reflect the motion since the last update, and then

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

In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics.

In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics. Additional Controls, Scope, Random Numbers, and Graphics CS109 In this lecture we will briefly examine a few new controls, introduce the concept of scope, random numbers, and drawing simple graphics. Combo

More information

Using C# for Graphics and GUIs Handout #2

Using C# for Graphics and GUIs Handout #2 Using C# for Graphics and GUIs Handout #2 Learning Objectives: Review Math methods C# Arras Drawing Rectangles Getting height and width of window Coloring with FromArgb() Sierpinski Triangle 1 Math Methods

More information

Making use of other Applications

Making use of other Applications AppGameKit 2 Collision Using Arrays Making use of other Applications Although we need game software to help makes games for modern devices, we should not exclude the use of other applications to aid the

More information

What is a variable? a named location in the computer s memory. mousex mousey. width height. fontcolor. username

What is a variable? a named location in the computer s memory. mousex mousey. width height. fontcolor. username What is a variable? a named location in the computer s memory mousex mousey width height fontcolor username Variables store/remember values can be changed must be declared to store a particular kind of

More information

System Analysis and Design

System Analysis and Design System Analysis and Design LAB RECORD-INFS -280/L Information Systems Department University of Nizwa, Sultanate of Oman Table of Contents Task. No: Title Page Nos. Date 1) VB Text box and Message Button

More information

SketchUp Starting Up The first thing you must do is select a template.

SketchUp Starting Up The first thing you must do is select a template. SketchUp Starting Up The first thing you must do is select a template. While there are many different ones to choose from the only real difference in them is that some have a coloured floor and a horizon

More information

AN INTRODUCTION TO SCRATCH (2) PROGRAMMING

AN INTRODUCTION TO SCRATCH (2) PROGRAMMING AN INTRODUCTION TO SCRATCH (2) PROGRAMMING Document Version 2 (04/10/2014) INTRODUCTION SCRATCH is a visual programming environment and language. It was launched by the MIT Media Lab in 2007 in an effort

More information

Package: java.util It generates random numbers An instance is created by using one of the two constructors:

Package: java.util It generates random numbers An instance is created by using one of the two constructors: Exercise 5.2 The documentation contains the following sections: Overall description of the class: its purpose and how to use it A brief summary of the fields A brief summary of the constructors A brief

More information

Unit 3. Lesson Designing User Interface-2. TreeView Control. TreeView Contol

Unit 3. Lesson Designing User Interface-2. TreeView Control. TreeView Contol Designing User Interface-2 Unit 3 Designing User Interface-2 Lesson 3.1-3 TreeView Control A TreeView control is designed to present a list in a hierarchical structure. It is similar to a directory listing.

More information

Santiago Canyon College Computer Science

Santiago Canyon College Computer Science P a g e 1 Santiago Canyon College Computer Science The.Net Threading Model Introduction The purpose of this paper is to introduce you to multi-threading in Visual Studio. Learning how to take advantage

More information

INTRODUCTION TO THE MATLAB APPLICATION DESIGNER EXERCISES

INTRODUCTION TO THE MATLAB APPLICATION DESIGNER EXERCISES INTRODUCTION TO THE MATLAB APPLICATION DESIGNER EXERCISES Eric Peasley, Department of Engineering Science, University of Oxford version 4.6, 2018 MATLAB Application Exercises In these exercises you will

More information

Class Test 5. Create a simple paint program that conforms to the following requirements.

Class Test 5. Create a simple paint program that conforms to the following requirements. Class Test 5 Question 1 Use visual studio 2012 ultimate to create a C# windows forms application. Create a simple paint program that conforms to the following requirements. The control box is disabled

More information

Form Properties Window

Form Properties Window C# Tutorial Create a Save The Eggs Item Drop Game in Visual Studio Start Visual Studio, Start a new project. Under the C# language, choose Windows Form Application. Name the project savetheeggs and click

More information

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

VISUAL BASIC PROGRAMMING (44) Technical Task KEY. Regional 2013 TOTAL POINTS (485) 5 Pages VISUAL BASIC PROGRAMMING (44) Technical Task KEY Regional 2013 TOTAL POINTS (485) Graders: Please double-check and verify all scores! Property of Business Professionals of America. May be reproduced

More information

BSc. (Hons.) Software Engineering. Examinations for / Semester 2

BSc. (Hons.) Software Engineering. Examinations for / Semester 2 BSc. (Hons.) Software Engineering Cohort: BSE/04/PT Examinations for 2005-2006 / Semester 2 MODULE: OBJECT ORIENTED PROGRAMMING MODULE CODE: BISE050 Duration: 2 Hours Reading Time: 5 Minutes Instructions

More information

8359 Object-oriented Programming with Java, Part 2. Stephen Pipes IBM Hursley Park Labs, United Kingdom

8359 Object-oriented Programming with Java, Part 2. Stephen Pipes IBM Hursley Park Labs, United Kingdom 8359 Object-oriented Programming with Java, Part 2 Stephen Pipes IBM Hursley Park Labs, United Kingdom Dallas 2003 Intro to Java recap Classes are like user-defined types Objects are like variables of

More information

CompSci 230 Software Construction

CompSci 230 Software Construction CompSci 230 Software Construction Lecture Slides #3: Introduction to OOD S1 2015 Version 1.1 of 2015-03-12: added return to code on slides 10, 13 Topics: Agenda Software Design (vs. hacking) Object-Oriented

More information

Final Exam Winter 2013

Final Exam Winter 2013 Final Exam Winter 2013 1. Which modification to the following program makes it so that the display shows just a single circle at the location of the mouse. The circle should move to follow the mouse but

More information

Chapter 8. Classes and Objects

Chapter 8. Classes and Objects Chapter 8 Classes and Objects Data Abstrac4on In Java there are three types of data values: primi4ve data values (int, float, boolean, etc.) arrays (actually a special type of object) objects Objects in

More information

Assignment 5: Part 1 (COMPLETE) Sprites on a Plane

Assignment 5: Part 1 (COMPLETE) Sprites on a Plane Assignment 5: Part 1 (COMPLETE) Sprites on a Plane COMP-202B, Winter 2011, All Sections Due: Wednesday, April 6, 2011 (13:00) This assignment comes in TWO parts. Part 2 of the assignment will be published

More information

Bits and Bytes. How do computers compute?

Bits and Bytes. How do computers compute? Bits and Bytes How do computers compute? Representing Data All data can be represented with: 1s and 0s on/of true/false Numbers? Five volunteers... Binary Numbers Positional Notation Binary numbers use

More information

REVIEW OF CHAPTER 1 1

REVIEW OF CHAPTER 1 1 1 REVIEW OF CHAPTER 1 Trouble installing/accessing Visual Studio? 2 Computer a device that can perform calculations and make logical decisions much faster than humans can Computer programs a sequence of

More information

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

Connection Example. Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date : Connection Example Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date : 2009-06-19 page 1 Table of Contents Connection Example... 2 Adding the Code... 2 Quick Watch myconnection...

More information

ICS3C/4C/3U/4U Unit 2 Workbook Selection: If Statement

ICS3C/4C/3U/4U Unit 2 Workbook Selection: If Statement Selection: If Statement Selection allows a computer to do different things based on the situation. The if statement checks if something is true and then runs the appropriate code. We will start learning

More information

BLM Answers. BLM 4-1 Prerequisite Skills. BLM 4-3 Section 4.1 Modelling With Quadratic Relations. 10. a)

BLM Answers. BLM 4-1 Prerequisite Skills. BLM 4-3 Section 4.1 Modelling With Quadratic Relations. 10. a) BLM Answers (page 1) BLM 4-1 Prerequisite Skills 1. a) 11.1 2.7 9.0 d) 20.2 2. a) 1.7 10.7 6.5 d) 25.1 3. a) 9.5 20.7 96 d) 31.85 4. a) 3x 6x 2 + 6x + 5 10x 2 2x + 6 d) 12x 2 + 10x 6 5. a) 5 0 12 d) 2

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

Interaction Design A.A. 2017/2018

Interaction Design A.A. 2017/2018 Corso di Laurea Magistrale in Design, Comunicazione Visiva e Multimediale - Sapienza Università di Roma Interaction Design A.A. 2017/2018 8 Loops and Arrays in Processing Francesco Leotta, Andrea Marrella

More information

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

Instructor s Notes Programming Logic Printing Reports. Programming Logic. Printing Custom Reports Instructor s Programming Logic Printing Reports Programming Logic Quick Links & Text References Printing Custom Reports Printing Overview Page 575 Linking Printing Objects No book reference Creating a

More information

Load your files from the end of Lab A, since these will be your starting point.

Load your files from the end of Lab A, since these will be your starting point. Coursework Lab B It is extremely important that you finish lab A first, otherwise this lab session will probably not make sense to you. Lab B gives you a lot of the background and basics. The aim of the

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

10 Object oriented programming

10 Object oriented programming 250 Java Programming for A-level Computer Science 10 Object oriented programming Java is an object oriented programming language. The use of objects has a number of important advantages, particularly when

More information

CSC 160 LAB 8-1 DIGITAL PICTURE FRAME. 1. Introduction

CSC 160 LAB 8-1 DIGITAL PICTURE FRAME. 1. Introduction CSC 160 LAB 8-1 DIGITAL PICTURE FRAME PROFESSOR GODFREY MUGANDA DEPARTMENT OF COMPUTER SCIENCE 1. Introduction Download and unzip the images folder from the course website. The folder contains 28 images

More information

slide 1 gaius Python Classes you can use theclass keyword to create your own classes here is a tiny example of a class

slide 1 gaius Python Classes you can use theclass keyword to create your own classes here is a tiny example of a class Python Classes slide 1 you can use theclass keyword to create your own classes here is a tiny example of a class Python Classes slide 2 tinyclass.py #!/usr/bin/python import math class vector: def init

More information

Object-Oriented Programming in Processing

Object-Oriented Programming in Processing Object-Oriented Programming in Processing Object-Oriented Programming We ve (kinda) been doing this since Day 1: Python is a deeply object oriented language Most of the data types we were using (strings,

More information

Object-Oriented Language Development Company

Object-Oriented Language Development Company Object-Oriented Language Development Company The OLD Co Pong Game: Executive Summary The Object-Oriented Language Development Company (OLD Co.) has begun development of a radically new computer game, with

More information

Model Solutions. COMP 102: Test 1. 6 April, 2016

Model Solutions. COMP 102: Test 1. 6 April, 2016 Family Name:.............................. Other Names:............................. ID Number:............................... Signature.................................. Model Solutions COMP 102: Test

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

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

CSS Selectors. element selectors. .class selectors. #id selectors

CSS Selectors. element selectors. .class selectors. #id selectors CSS Selectors Patterns used to select elements to style. CSS selectors refer either to a class, an id, an HTML element, or some combination thereof, followed by a list of styling declarations. Selectors

More information

Chapter 5. Condi.onals

Chapter 5. Condi.onals Chapter 5 Condi.onals Making Decisions If you wish to defrost, press the defrost bu=on; otherwise press the full power bu=on. Let the dough rise in a warm place un.l it has doubled in size. If the ball

More information

1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4'

1. Which of the following is the correct expression of character 4? a. 4 b. 4 c. '\0004' d. '4' Practice questions: 1. Which of the following is the correct expression of character 4? a. 4 b. "4" c. '\0004' d. '4' 2. Will System.out.println((char)4) display 4? a. Yes b. No 3. The expression "Java

More information

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

BSc (Hons) Computer Science with. Network Security. BSc (Hons) Business Information Systems. Examinations for 2018 / Semester 1 BSc (Hons) Computer Science with Network Security BSc (Hons) Business Information Systems Cohort: BCNS/17A/FT Examinations for 2018 / Semester 1 Resit Examinations for BIS/16B/FT, BCNS/15A/FT, BCNS/15B/FT,

More information

CISC 1600, Lab 2.3: Processing animation, objects, and arrays

CISC 1600, Lab 2.3: Processing animation, objects, and arrays CISC 1600, Lab 2.3: Processing animation, objects, and arrays Prof Michael Mandel 1 Getting set up For this lab, we will again be using Sketchpad. sketchpad.cc in your browser and log in. Go to http://cisc1600.

More information

Programming: You will have 6 files all need to be located in the dir. named PA4:

Programming: You will have 6 files all need to be located in the dir. named PA4: PROGRAMMING ASSIGNMENT 4: Read Savitch: Chapter 7 and class notes Programming: You will have 6 files all need to be located in the dir. named PA4: PA4.java ShapeP4.java PointP4.java CircleP4.java RectangleP4.java

More information

Java Class Design. Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding

Java Class Design. Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding Java Class Design Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding eugeny.berkunsky@gmail.com http://www.berkut.mk.ua Objectives Implement encapsulation Implement inheritance

More information

Learning VB.Net. Tutorial 17 Classes

Learning VB.Net. Tutorial 17 Classes Learning VB.Net Tutorial 17 Classes 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

Disclaimer. Trademarks. Liability

Disclaimer. Trademarks. Liability Disclaimer II Visual Basic 2010 Made Easy- A complete tutorial for beginners is an independent publication and is not affiliated with, nor has it been authorized, sponsored, or otherwise approved by Microsoft

More information

HO-1: INTRODUCTION TO FIREWORKS

HO-1: INTRODUCTION TO FIREWORKS HO-1: INTRODUCTION TO FIREWORKS The Fireworks Work Environment Adobe Fireworks CS4 is a hybrid vector and bitmap tool that provides an efficient design environment for rapidly prototyping websites and

More information

1. Complete these exercises to practice creating user functions in small sketches.

1. Complete these exercises to practice creating user functions in small sketches. Lab 6 Due: Fri, Nov 4, 9 AM Consult the Standard Lab Instructions on LEARN for explanations of Lab Days ( D1, D2, D3 ), the Processing Language and IDE, and Saving and Submitting. Rules: Do not use the

More information

Introduction. Create a New Project. Create the Main Form. Assignment 1 Lights Out! in C# GUI Programming 10 points

Introduction. Create a New Project. Create the Main Form. Assignment 1 Lights Out! in C# GUI Programming 10 points Assignment 1 Lights Out! in C# GUI Programming 10 points Introduction In this lab you will create a simple C# application with a menu, some buttons, and an About dialog box. You will learn how to create

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

Iteration in Programming

Iteration in Programming Iteration in Programming for loops Produced by: Mairead Meagher Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topics list There are three types of loop in programming: While

More information

Efficiency of Bubble and Shell Sorts

Efficiency of Bubble and Shell Sorts REVIEW Efficiency of Bubble and Shell Sorts Array Elements Bubble Sort Comparisons Shell Sort Comparisons 5 10 17 10 45 57 15 105 115 20 190 192 25 300 302 30 435 364 50 1225 926 100 4950 2638 500 124,750

More information

Chapter 13. Graphics, Animation, Sound and Drag-and-Drop The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill

Chapter 13. Graphics, Animation, Sound and Drag-and-Drop The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Chapter 13 Graphics, Animation, Sound and Drag-and-Drop McGraw-Hill 2010 The McGraw-Hill Companies, Inc. All rights reserved. Chapter Objectives - 1 Use Graphics methods to draw shapes, lines, and filled

More information

Tools of Design Select Mode vs. Text Mode Select Mode allows you to alter the position and size of both text and clipart Text Mode allows you change text size, font and characters but you CANNOT

More information

FrontCounter BC Discovery Tool Instructions. NOTE: You must have Google Earth installed to use this tool.

FrontCounter BC Discovery Tool Instructions. NOTE: You must have Google Earth installed to use this tool. NOTE: You must have Google Earth installed to use this tool. These instructions are written for use with a Microsoft Windows Work Station. This tutorial will step you through navigating to and viewing

More information

Programming Project 1

Programming Project 1 Programming Project 1 Handout 6 CSCI 134: Fall, 2016 Guidelines A programming project is a laboratory that you complete on your own, without the help of others. It is a form of take-home exam. You may

More information

Interactive Tourist Map

Interactive Tourist Map Adobe Edge Animate Tutorial Mouse Events Interactive Tourist Map Lesson 1 Set up your project This lesson aims to teach you how to: Import images Set up the stage Place and size images Draw shapes Make

More information

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

1 Dept: CE.NET Programming ( ) Prof. Akash N. Siddhpura. Working with Form: properties, methods and events Working with Form: properties, methods and events To create a New Window Forms Application, Select File New Project. It will open one dialog box which is shown in Fig 2.1. Fig 2.1 The New Project dialog

More information

Creating objects TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with.

Creating objects TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with. 1 Outline TOPIC 3 INTRODUCTION TO PROGRAMMING Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

Firstly, I would like to thank ProFantasy for hosting this tutorial on the RPGMaps Blog. Thank you!

Firstly, I would like to thank ProFantasy for hosting this tutorial on the RPGMaps Blog. Thank you! Firstly, I would like to thank ProFantasy for hosting this tutorial on the RPGMaps Blog. Thank you! Before we start, it is important that you fully understand what a shaded polygon is, and what it does.

More information

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

โปรแกรมช วยทดสอบหม อแปลงกระแส โปรแกรมช วยทดสอบหม อแปลงกระแส 1.เมน ของโปรแกรม ภาพท 1 หน าเมน ของโปรแกรม Public Class frmmain Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

More information

learning outcomes 10 min.

learning outcomes 10 min. Reflecting light Light H 49 time 60 minutes Tip. In this lesson every child makes their own periscope. If you prefer they can also work in pairs or small groups. learning outcomes To: know that light always

More information

Outline. Turtles. Creating objects. Turtles. Turtles in Java 1/27/2011 TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with.

Outline. Turtles. Creating objects. Turtles. Turtles in Java 1/27/2011 TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with. 1 Outline 2 TOPIC 3 INTRODUCTION TO PROGRAMMING Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information