Visual BasicC++ Diane Zak. Microsoft © Small (But Powerful) Basic Presented by Diane Zak.

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

How can Microsoft PowerPoint 2007 help you share information?
Microsoft® Small Basic
© Paradigm Publishing, Inc Excel 2013 Level 2 Unit 2Managing and Integrating Data and the Excel Environment Chapter 7Automating Repetitive Tasks.
Microsoft Visual Basic: Reloaded Chapter Seven More on the Repetition Structure.
Objectives Understand the software development lifecycle Perform calculations Use decision structures Perform data validation Use logical operators Use.
Microsoft® Small Basic
HTML Comprehensive Concepts and Techniques Second Edition Project 8 Integrating JavaScript with HTML.
Copyright 2007, Paradigm Publishing Inc. POWERPOINT 2007 CHAPTER 1 BACKNEXTEND 1-1 LINKS TO OBJECTIVES Create Presentation Open, Save, Run, Print, Close,Delete.
Information Technology Center Hany Abdelwahab Computer Specialist.
Customizing Outlook. Forms Window in which you enter and view information in Outlook Outlook Form Designer The environment in which you create and customize.
Adding Automated Functionality to Office Applications.
BoardMaker Ver 6 Creating Interactive Activities for the Classroom.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
Microsoft Visual Basic 2005 CHAPTER 8 Using Procedures and Exception Handling.
CHAPTER SIX Loop Structures.
CHAPTER 6 Loop Structures.
Variables and Functions Chapter Variables Named storage location in computer’s memory Programs may need to store data when running o Stored in.
® Microsoft Access 2010 Tutorial 11 Using and Writing Visual Basic for Applications Code.
Using Arrays and File Handling
© 2011 Delmar, Cengage Learning Chapter 9 Introduction to ActionScript 3.0.
Understanding Web Sites. What is a Web Site A collection of Web pages which you can view on the Internet Contains text, graphics, sound, and video to.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 2 Welcome Application Introducing the Visual Basic 2008 Express Edition IDE.
Introduction to Visual Basic.NET Programming In Visual Basic.NET.
Chapter 12: How Long Can This Go On?
Visual Basic 2005 CHAPTER 2 Program and Graphical User Interface Design.
Integrated Development Environment (IDE)
Addison Wesley is an imprint of © 2010 Pearson Addison-Wesley. All rights reserved. Chapter 7 The Game Loop and Animation Starting Out with Games & Graphics.
Program Design and Coding
Microsoft Visual Basic 2012 CHAPTER THREE Program Design and Coding.
Microsoft Visual Basic 2010 CHAPTER THREE Program Design and Coding.
Lecture 6: Computer Languages. Programming Environments (IDE) COS120 Software Development Using C++ AUBG, COS dept.
CMPS 1371 Introduction to Computing for Engineers MatLab.
Chapter Two Creating a First Project in Visual Basic.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 8 Debugging, Creating Executable Files, and Distributing a Windows Application.
Loops & Graphics IP 10 Mr. Mellesmoen Recall Earlier we wrote a program listing numbers from 1 – 24 i=1 start: TextWindow.WriteLine(i) i=i+1 If.
The parts of a Computer Window
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 2.1 Test-Driving the Welcome Application 2.2.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
CSC 1010 Programming for All Lecture 7 Input, Output & Graphics.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
Creating visual interfaces in python
Microsoft Visual Basic 2010 CHAPTER TWO Program and Graphical User Interface Design.
Computer Programming Modeling a Passive Solar Home.
HTML Concepts and Techniques Fifth Edition Chapter 3 Creating Web Pages with Links, Images, and Formatted Text.
Microsoft® Small Basic Exploring Shapes Estimated time to complete this lesson: 1 hour.
CRE Programming Club - Class 5 Robert Eckstein and Robert Heard.
BBT 10 Visual Basic 03 Enrichment. Tip Before creating any files for your project, first create a new folder Save all of your files in the folder Pieces.
Interaction with Graphics Also displaying GIFs. Text Output on the graphics window There is a class called Text which will put the message on the graphics.
Introduction to Computer Programming - Project 2 Intro to Digital Technology.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
Microsoft Visual Basic 2012 CHAPTER FOUR Variables and Arithmetic Operations.
Scratch for Interactivity Dr. Ben Schafer Department of Computer Science University of Northern Iowa.
COMPREHENSIVE Access Tutorial 11 Using and Writing Visual Basic for Applications Code.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 6 Looping and Multiple Forms.
Introducing the turtle
COMPREHENSIVE PowerPoint Tutorial 5 Applying Advanced Special Effects in Presentations.
COMPREHENSIVE Excel Tutorial 12 Expanding Excel with Visual Basic for Applications.
Scratch for Interactivity
A Tiny Look at the Graphics Window
Program and Graphical User Interface Design
Objectives Learn about Function procedures (functions), Sub procedures (subroutines), and modules Review and modify an existing subroutine in an event.
Variables and Arithmetic Operations
Microsoft® Small Basic
Microsoft® Small Basic
Introduction to TouchDevelop
An Introduction to Computers and Visual Basic
A Tiny Look at the Graphics Window
Chapter 1 Introducing Small Basic
Chapter 9 Using Decisions to
Presentation transcript:

Visual BasicC++ Diane Zak

Microsoft © Small (But Powerful) Basic Presented by Diane Zak

1GB Silicone Wrist Band Flash Drive You are welcome to take them home!

Overview Walk-throughs Code snippets Activities Wrap-up

OVERVIEW

What is it? 1. Language 2. IDE 3. Libraries Created by: Vijaye Raji at Microsoft

Language Variables Assignment statements Concatenation, arithmetic, relational, logical operators Mathematical functions Graphics (shapes and controls) If statements, For and While loops Arrays Sequential access file processing Text (string) manipulation methods Sub procedures and events

IDEIDE Intellisense Help

Libraries ArrayMouse ClockNetwork ControlsProgram DesktopShapes DictionarySound FileStack FlickrText GraphicsWindowTextWindow ImageListTimer MathTurtle

1.Language 2. IDE 3. Libraries

Requirements? Small Basic Windows XP, Vista, 7.NET Framework 3.5

Why would I want to learn it?

Fun and easy way to introduce programming Intro to Computers Intro to Programming College Freshmen Day High School Recruitment

How can I teach it?

Turtle Object TextWindow sequence only or combined with selection

TextWindow sequence, selection, repetition, sound, and random numbers

GraphicsWindow and Turtle sequence only or combined with selection and repetition

GraphicsWindow and Turtle sequence only

GraphicsWindow sequence and repetition

GraphicsWindow sequence, selection, repetition, random numbers, and counters

GraphicsWindow sequence, selection, arrays, controls, and procedures

GraphicsWindow sequence, selection, arrays, controls, and procedures

Walk-throughs

TextWindow

On your own: 1.Enter a TextWindow.Write statement that displays the message “Gallons: ” 2.Enter a TextWindow.ReadNumber statement that assigns the user’s input to the gallons variable

Arithmetic operations +addition (also can be used for concatenation) –subtraction *multiplication /division Math.Powerexponentiation Math.Floorinteger division

mpg = miles / gallons

TextWindow.WriteLine(mpg)

Math object’s Round method mpg = Math.Round(mpg)

String concatenation operator + "Miles per gallon: " + mpg

Publish

Import

If Statement If condition Then statements [ElseIf condition Then statements] [Else statements] EndIf

If mpg > 30 Then TextWindow.WriteLine("Great") Else TextWindow.WriteLine("Not great") EndIf

Save using Mpg and then run. Then publish again.

Graduate to Visual Basic

Turtle

1.Close the mpg program. 2.Open a new document. 3.Save the new document as MyFirstTurtle.

1.Create a 10 line program using the following commands. Keep in mind that the default height and width of the GraphicsWindow is 442 and 624 pixels, respectively. 2.Save and then run. Turtle.Speed = number from 1 through 10 Turtle.Move(number of pixels) Turtle.MoveTo(x, y) Turtle.TurnLeft() Turtle.TurnRight()

1.Close the MyFirstTurtle program. 2.Open the Hi.sb file contained in the Class folder. 3.Run the program.

1. ' Lines 2 through 8 will center the GraphicsWindow 2. GraphicsWindow.Hide() 3. gwH = gwW = GraphicsWindow.Left = (Desktop.Width - gwW) / 2 6. GraphicsWindow.Top = (Desktop.Height - gwH) / 2 7. GraphicsWindow.Height = gwH 8. GraphicsWindow.Width = gwW 10. ' Line 11 displays text on the title bar 11. GraphicsWindow.Title = "Hi" 13. ' Line 14 shows the GraphicsWindow 14. GraphicsWindow.Show() 16. ' Line 17 sets the Turtle's speed 17. Turtle.Speed= ' position turtle and draw left vertical line in H 20. Turtle.X = Turtle.Y = Turtle.Move(250)

24. ' reposition turtle and draw right vertical line in H 25. Turtle.PenUp() 26. Turtle.X = Turtle.Angle = Turtle.PenDown() 29. Turtle.Move(250)

31. ' reposition turtle and draw horizontal line in H 32. Turtle.PenUp() 33. Turtle.Y = Turtle.TurnRight() 35. Turtle.PenDown() 36. Turtle.Move(50)

38. ' reposition turtle and draw vertical line in i

38. ' reposition turtle and draw vertical line in i 39. Turtle.PenUp() 40. Turtle.X = Turtle.Y = Turtle.TurnRight() 43. Turtle.PenDown() 44. Turtle.Move(200) Answer

Drawing Shapes 46. ' draw circle above vertical line in i 47. <use the GraphicsWindow’s DrawEllipse method (Hint: use 145 and 100 for X and Y, and use 10 for the width and height>

Drawing Shapes 46. ' draw circle above vertical line in i 47. GraphicsWindow.DrawEllipse(145, 100, 10, 10) Answer

1.Complete Lines 49 through Save and then run.

Images and Sound

1.Close the Hi program. 2.Open the PicViewer.sb file contained in the Class folder. 3.Run the program to see the effect of the existing code.

13. ' Lines 14 through 16 load the images and assign names to each 14. imgBirds = ImageList.LoadImage(Program.Directory + "\birds.jpg") 15. imgCat = ImageList.LoadImage(Program.Directory + "\cat.jpg") 16. imgTheEnd = ImageList.LoadImage(Program.Directory + "\TheEnd.jpg") 18. ' Lines 20 through 22 make each loaded image a Shape object that can 19. ' be moved, animated, shown, hidden, or rotated 20. birds = Shapes.AddImage(imgBirds) 21. cat = Shapes.AddImage(imgCat) 22. theEnd = Shapes.AddImage(imgTheEnd)

24. ' Lines 25 through 27 position each Shape object at the right edge of the GraphicsWindow 25. Shapes.Move(birds, 650, 0) 26. Shapes.Move(cat, 650, 0) 27. Shapes.Move(theEnd,650, 0) 29. ' Lines 31 through 33 hide each Shape object (this is necessary because the 30. ' AddImage method automatically displays them on the GraphicsWindow 31. Shapes.HideShape(birds) 32. Shapes.HideShape(cat) 33. Shapes.HideShape(theEnd) 35. ' Line 36 shows the GraphicsWindow 36. GraphicsWindow.Show()

38. ' enter the code to play a wav file named PicViewer.wav 39. <Use the Sound object’s Play method, the Program object’s Directory method, and the concatenation operator to play the "\PicViewer.wav" file.>

38. ' enter the code to play a wav file named PicViewer.wav 39. Sound.Play(Program.Directory + "\PicViewer.wav") Answer

41. ' Lines 42 through 44 show the birds Shape object, animate it, and then delay the program 42. Shapes.ShowShape(birds) 43. Shapes.Animate(birds, -500, 0, 6000) 44. Program.Delay(4000)

1.Complete Lines 46 through Save and then run. 3.For an additional challenge, complete the DIFFERENT VERSION section.

Events and Sub Procedures

1.Close the PicViewer program. 2.Open a new document. 3.Save the new document as Hello.

1. Enter the following two lines of code: txtName = Controls.AddTextBox(100, 50) btnHello = Controls.AddButton("Hello", 100, 100) 2. Save and then run.

1. Enter Controls followed by a period. 2. Press the down arrow until the ButtonClicked event is selected.

Finish the statement as follows: Controls.ButtonClicked = OnButtonClick

Now we need to create the OnButtonClick event procedure. Enter the following lines of code: 5. Sub OnButtonClick 6. myName = Controls.GetTextBoxText(txtName) 7. GraphicsWindow.ShowMessage(myName, "Name Entry") 8. EndSub

1.Save and then run. 2.Click the text box and then type your name. 3.Click the Hello button.

Activities Now it’s time for you to have some fun!

Take your pick: 1.Create the Space Invaders game using the handout provided to you. 2.Look in the EXE folder on your flash drive for a program you might like to create. Then, locate the partially completed.sb file on your flash drive. The FolderContents.doc file on your flash drive provides some additional information about the program. 3.Create your own Small Basic program. 4.Check out the Coin Toss.sb program in the Coin Toss folder. 5.Import one or more of the following programs/games: XHX455 (Click Shapes)KXM316-0 (Calculator) CBX615 (Flower)LWL206-3 (Music Notes) MDJ923 (Paddle Game)PMT149 (Bouncing Balls)

Thank you for coming!

I hope you enjoyed the presentation

Have a great day!