Kebot: Robot Simulator

Size: px
Start display at page:

Download "Kebot: Robot Simulator"

Transcription

1 Kebot: Robot Simulator

2 » Completion of consent forms» Introduction to the research project» Structure of the workshop session» Advantages of taking part» Workshop has been designed for complete novices but if you need any help just ask!

3 » Most people don t know how a computer works and take for granted the programs they encounter everyday» Programming is like writing down the instructions it takes to do something - a process, a procedure» But programming is also creative. Some argue that writing a program is comparable to composing music, designing a house, or creating things» Why learn to program?

4 » Is going to be hands on you will learn by doing» Concepts will be introduced but you ll quickly move onto coding for yourselves» You ll have all the support you need to progress and the sessions have been designed to gradually build up knowledge» Code will be made available to help anyone who runs into difficulty» You will be using the JAVA programming language

5 » Methods used to teach programming are dull» They do little to encourage an interest in the subject» And can give programming a bad name» Hello World is a prime example

6

7

8

9 » Research found how little work has considered the use of simulated robots as programming learning tools» Simulators offer a more accessible method for learning programming than physical robots» To try and make things better» Fun!

10

11

12

13

14

15

16 » The Gates robot can be issued with several commands: forward() backward() left() right() stop()» These commands are called methods in programming. Think of them as sub-programs which contain instructions. These instructions have already been coded so all that is required is for the method to be called in your code (method invocation)

17 » The Gates robot already contains code instructing the robot to move forward and then turn left» Challenge: Place the Gates robot in the arena and then start the simulator. Observe how the robot follows these instructions.

18 » Open the Gates class. You will see the code: forward () ; left () ;» Two things must be noted: The double brackets after the method name and the semi-colon after the bracket.» Challenge: Expand your code so that the robot performs a square.

19 » To instruct the robot to perform a square your code will look like:

20 » Code Errors (Syntax Errors) occur when code does not conform to the conventions of the programming language» Syntax Errors must be corrected before code can be compiled» Whilst typing code the Undo function can be useful at reverting code back to its previous state if you make a mistake

21 » Kebot comes with drawing tools» A 2D Object is a flat drawing on the arena floor which a robot can travel over» A 3D object is a raised object (like a wall) which the robot bangs into» These features will be used more and more as the workshop progresses

22 » Arenas can be loaded by going to the File Menu and selecting Load Arena» Select the Square Drawer arena» It is possible to pass values to forward() and backward(). This allows greater control of the robot. Do this by putting a value in the brackets of the method name (e.g. forward (1) ; ). This value represents time (in seconds). Passing a value to a method is known as parameter passing» Challenge: Pass parameters to the methods in your existing code so that the robot remains within the confines of the Square Drawer arena. Call the stop() method at the end of your code to instruct the robot to stop moving.

23 » To instruct the robot to complete the Square Drawer task your code will look something like:

24 » Select the Line Tracer arena» Challenge: Using the following methods to instruct Gates to follow the line: forward() left() right() stop()» Some values you must pass to forward() are provided whilst others are not.» Tip: Write down and think about what you want to achieve before coding!

25 » Challenge: How does your robot fare when you introduce 3D objects into the arena? Can Gates navigate the walls you have drawn?

26 » To complete the task your code will look something like:» However, this code has 3 syntax errors. Can you spot them?

27

28

29 » The JAVA language has a number of formatting conventions. These help to improve the readability of code and make it easier to manage» Indentation helps to convey a programs structure. BlueJ automatically helps to indent code:» camelcase helps to differentiate between different programming concepts» Neither are compulsory for a program to compile, however, it is best to learn good habits early

30 » Methods ( e.g. forward() ) are like sub-programs which contain instructions. They can be called over and over» Syntax errors occur when code does not conform to the conventions of the programming language» Passing a value to a method ( e.g. forward (5); ) is known as parameter passing» Sequence is an important programming concept. This is when actions are executed in the order in which they appear what you have been doing so far!

31 Kebot: Robot Simulator

32 » No matter how simple or complex a program is, data has to be stored and managed in some way Variables and Constants are used to do this.» These are like shoeboxes, they are containers that store something» Shoeboxes come in different sizes and types depending on what shoe is being put in them. You wouldn t have one box for every shoe» This is similar to Variables and Constants - you have different types depending on the size and type of the data being stored

33 » Variables are used to store and manage data that is able to change while the program runs» Constants are used when you want to assign a value to a an object once and make it so this value can t change» Both Variables and Constants have their own naming conventions and must be given an initial value when declared

34 » Characteristics of Variables: They store data in computer memory for later use Their lifespan is limited by the duration of the program Data stored in the variable will be lost when the program ends

35 1. To use a Variable the type must first be declared 2. The Variable must then be given a name 3. The Variable must then be given an initial value 1. Type 2. Variable Name 3. Initial Value» Challenge: Clear your own code from the Gates class. Declare a integer Variable called duration with an initial value of 3

36 » Challenge: Create a short program which uses the forward() and backward() methods. However, instead of passing a literal value to these methods (e.g. forward (3) ; ) pass the value of the variable you created (e.g. forward (duration); )» Note how this Variable contains the value you assigned it when you declared the Variable» Challenge: Observe what happens when the robot tries to leave the bounds of the arena. Declare the duration Variable to a higher value whilst instructing the robot to move

37 » As already stated, Variables store data in computer memory for later use are limited by the duration of a program lose stored data when the program ends» Challenge: Select Display Information Panel from the Display Menu then run Kebot

38 » Note how Values of Variables can change as a program runs How when Kebot is reloaded the value of the Distance Travelled Variable is never stored and is limited by the duration of the program A small amount of additional code puts variables into a window like this. You ll be using the Distance Variable shortly

39 » Occasionally you may only want to assign a value to a an object once and make it so this value can t change» Values like 90 degrees for a right turn or the value of Pi never need to be modified» Constants are used to store such information

40 » Constants are also useful when you want to modify code that is repeated many times.» For instance, with the following code 4 changes have to be made if you want to change the amount the robot rotates:

41 » However, when a constant is used only 1 change to the code has to made:

42 1. To use a Constant you must first use the final keyword 2. The Constant must then be given a type 3. The Constant must be given a name 4. The Constant must be given an initial value 1. Final Keyword 2. Constant Type 3. Constant Name 4. Constant Value

43 Kebot: Robot Simulator

44 » Expressions are used when you want to evaluate whether one or more conditions is true or false» Expressions can range from simple mathematical calculations to something more complex» Expressions are made up of Variables, Methods and Operators» Operators allow you to better interact with the Variables in your code

45 » Differs from Gates in several ways: The information pane automatically loads when Berners is selected Berners starts from the same position each time in the arena Code is continually executed in a loop» Challenge: Load Kebot and select the Pauser Arena. Select the Berners Robot. Start the simulator

46 » The Berners class comes with the following code: x is equal to 1 if x is greater than 0 then go forward» A Variable called distance has also been declared for you. This is of type double which is the standard data type when you use decimal point numbers. This variable contains how far the robot has travelled (in m)

47 » Challenge: Delete the variable declaration int x = 1 from your code. Now instruct Berners to move forward if distance is less than 1 metre by using the distance Variable which has been declared for you.» Tip: To do this only three changes have to be made to your existing code all of these in the condition of the if statement (e.g. if ( make changes here ) )» Comparison Operators: Greater Than > Less Than <

48

49 » The if statement you have used only executes code if a condition is true» The if else if statement, however, can be used to select which block of code to execute: New Code

50 » The if else if else statements allow for even more conditions to be evaluated» Else statements will always be executed if the preceding conditions are not true. Hence conditions have to be ordered logically.

51 » The if statement can also compare two values: if distance is greater than 1.0 AND distance is less than 2.0 variable name operator value comparison

52 » Challenge: Follow the template and instruct Berners as follows: if distance is less than 1.0 move forward else if distance is greater than 1.0 AND less than 1.2 pause for 5 seconds then move forward for 10 seconds else stop

53

54 » Challenge: Modify your code as follows: if distance is less than 1.0 move forward for 1 second else if distance is greater than 1.0 and distance is less than 1.2 pause for 5 seconds then move forward 4 seconds else if distance is greater than 1.5 and distance is less than 1.7 pause for 5 seconds then move forward 6 seconds else stop

55

56 » Challenge: Load the Shapes arena. Attempt to program Berners to follow the instructions that are provided. You will need to use a if else if else if else statement to solve the task

57

58 » Expressions are used when you want to evaluate whether one or more conditions is true or false» Double is the standard data type when you use decimal point numbers» if else if statements allow the program to select which block of code to execute if a condition is true» if statements can also compare values: e.g. if ( distance > 1.0 && distance < 2.0 )

59 Kebot: Robot Simulator

60 » As you will see during the workshop, programs are very good at performing repetitive tasks. Counting objects is a good example» A common programming task is to increase a variable's value by 1, or to decrease by 1, each time a certain condition is met» Increasing by 1 is called incrementing.» Decreasing by 1 is called decrementing.

61

62 » Challenge: Declare an class variable called count with the value 0. To do this declare the variable here:» Scroll to the bottom of the Berners class. Copy the Line Counter Example Code and place this in robotcommands()» Run Kebot and Load the Line Counter Arena from the File Menu

63 » Your code should compile but Berners will not perform an action» First you must instruct your robot to move forward» Second you must use the count variable to count the number of times a 2D object is encountered. Do this by declaring: or» Challenge: Instruct the robot to move forward and to add 1 to the count variable each time a 2D object is detected. Where do you think these two pieces of code should go?

64 » Challenge: Launch Kebot. Draw several 2D freehand lines within the designated space that is drawn. Observe the result

65 » It is possible to nest if statements (as well as if Else, if else if statements etc). Nesting an if statement just means putting one if statement inside another:» Challenge: Declare another if statement (in the body of the if you already have) which calls the endcount() method if the count is greater than a number of your choosing.

66

67 » A Boolean variable is used in the Line Counter example» Boolean variables have only two values: true or false» During the Line Counter task the if would only execute if an object is detected (i.e. the condition is true)» Booleans are declared like the other variables: 1. Type 2. Variable Name 3. Initial Value

68 » Is the standard output function used in JAVA. It is very useful for testing and development purposes and prints textual output to the terminal window similar to a text box» Challenge: Declare a Boolean called status with an initial value of false. In your existing if statement remove your previous code and declare status to be true.» Below this if statement type:

69 » Challenge: Load the Line Counter Arena. Observe how the status of the robots sensors are constantly evaluated and that this value is printed to the terminal window

70

71 » Nested if statements simply involves putting one if statement inside another» Boolean variable have only two values: true or false» System.out.println is the standard output function used in JAVA and allows information (such as the value of variables) to be printed to the terminal window. This can be useful for testing and development purposes.

72

73 Kebot: Robot Simulator

74 » So far you have used several methods in your code - forward(), backward(), left(), right() etc.» During this part of the workshop you ll be using a set of more advanced methods. These allow greater flexibility when programming your robots» You ll also be using a new robot Jobs

75 Method move() turn() Details Used to move forward or backward Speed is passed to method and can range m/s To move forward pass a positive value - e.g. move (0.1) To move backward pass a negative value - e.g. move (- 0.1) Used to turn left or right Rotation speed is passed to method (up to 180 degrees per second) To turn left pass a positive value - e.g. turn (90) To turn right pass a negative value - e.g. turn(- 90) Instructs how long to perform the previous command for: duration() e.g. move forward at 0.1m/s for 10 seconds rotate 90 degrees for 1 second

76 » The robotcommands method where you will be coding continually loops around. If you have the code» The robot won t stop moving forward after the 10 seconds have passed due to this code returning to the beginning of the code again» The pause() or stop() methods must be used at the end of your code if you do not want the code to run again

77 » The Jobs robot comes pre-loaded with some partially complete code. Expand this code so that it resembles:» Challenge: Can you modify this code so that you robot performs a figure of 8?

78

79 » allow greater interaction with surroundings. For instance, robots can be programmed to seek or avoid objects» Challenge: Load Kebot, select Jobs. Select the Sensor Coverage option from the Display menu» The leftsensorvalue() and rightsensorvalue() methods are used to calculate the distance between the robot and 3D objects. 3D objects are like walls - they cannot be climbed and are brick coloured

80 » Challenge: Using the System.out.println command print the value of the left or right sensor to the terminal window. Variables (of type double) called leftsensor and rightsensor have already been declared for you» What is the maximum range of these sensors?» Introduce 3D objects into the arena and move Jobs closer to these. Observe how when the simulator runs the values stored in these variables change

81 » This is the value you will be working with when using the proximity sensors i.e. if an object is within 0.1m pause, if an object is within 0.3m of the right sensor turn etc

82 » The following code instructs the robot to move forward if nothing is within 0.5m, otherwise to stay still:» Challenge: Modify this code so that your robot exhibits scared behaviour (i.e. the robot moves back if a 2D object is too close). Test your code by moving a 2D object near to your robot while the simulator is running

83

84 » Challenge: Program an if else if else statement that enables the robot to simulate curious behaviour: If the robot is within a certain distance of an object move back Else if the robot is a certain distance away from an object move forward Else stay still» Challenge: Test your code works as expected when a 2D object is introduced in the arena. Use the Move Environment tool to move objects you have drawn.

85

86 » Challenge: Program an if else if else statement that enables the robot to simulate avoiding behaviour: If the left sensor detects an object stop moving and turn right 45 degrees for one second Else if [Your Code Here] Else move forward but don t rotate» Challenge: Test your code works as expected when a 2D object is introduced and moved in the arena

87

88 » Challenge: Load Kebot. Draw a large square in the arena:» Challenge: Attempt to program your robot so that it is able to follow the walls within this square

89 » The solution will probably be a if else if else statement (although there is more than one way to solve the task) If nothing is detected close move forward Else if something is close turn for 1 second then stop turning Else stop turning and move forward» This task bears similarities to a maze solving one

90

91 Kebot: Robot Simulator

92 » You have already encountered 3 data types» However, there are 5 additional types that need to be briefly considered» The Data Types Helper Program allows you to explore different aspects of these data types

93 » Is a stand alone program with several features» It can be used to explore several aspects of programming» Load the Helper Application» The program comes with a Help Sheet which contains information about some of the data types you have already used

94 » When you enter in the Helper Application the optimal type for that data is provided» Information relevant to the data type is also provided including information of other types that could be used» There is also the option to hide the Help Sheet

95 » Two new data types are listed on the Help Sheet: Strings and Char:» Strings are used to display/contain textual information e.g. Hi Hello» Char is used to display single characters e.g. a b c

96 » As you know, int is the data type that is normally used to declare whole numbers» However, there are three other numeric data types that can be used: byte, short, long» Different data types exist as each one allocates a different amount of memory when a program starts. When memory saving really matters (e.g. on a spaceship s computer, mobile phone applications) this can be crucial remember the shoe boxes» However, for our purposes we will only be using the int data type during the workshop for whole number values

97 » Challenge: Using the Helper Application to enter different kinds of data, experiment to find out the following What must you do to text you want to declare as a String? What must you do to a character you want to declare as a Char? What are the value ranges of the byte and short data types? What are the value ranges of the int and long data type? There is an eighth data type that can be used with floating point numbers. Can anybody find the name of this and how to declare it?

98 What must you do to text you want to declare as a String? What must you do to a character you want to declare as a Char? What are the value ranges of the byte and short data types? Byte: -128 to 127 Short: -32,768 to 32, 767 What are the value ranges of the int and long data type? Int: -2,147,483,648 to 2,147,483,647 Long: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 There is an eighth data type that can be used with floating point numbers. Can anybody find the name of this and how to declare it? Floats are used instead of double to save memory. We do not use this data type for the exact values such as currency.

99 Data Type Used For Range Byte Whole Numbers -128 to 127 Short Whole Numbers -32,768 to 32,767 Int Whole Numbers -2,147,483,648 to 2,147,483,647 Long Whole Numbers -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 Float Decimal Numbers Up to Double Decimal Numbers Up to or even more Char Characters Individual Characters String Strings String of Characters Boolean True/False True/False

100 Kebot: Robot Simulator

101 » Are useful when we want to execute a single block of code several (or possibly hundreds) of times» Examples include constantly checking the state of a robots sensors or waiting until valid input is entered by the user» The robotcommands() method where you have been coding is an example of a loop. The loop has been designed so the robots sensors are constantly interrogated» Challenge: Print line the value of the secondssincestartof 2012() method in Jobs in order to observe first hand how quickly loops execute

102 » Challenge: Load the Gosling robot and you will find the following example of a while loop Power initially 5 While power is not equal to 0 End the program once it breaks out of the loop

103 » Challenge: Change the program so that each time the loop is executed the power variable decreases by one» The previous example highlights how a program can not proceed until the condition in the loop has been satisfied. The program is essentially stuck in a loop until this happens» Endless loops can cause severe problems. As the robotcommands() loop shows, however, not all endless loops are bad

104 » Challenge: What do you think would happen if the System.exit(0) command was deleted?

105 » Do While Loops are largely similar to While Loops with one major difference the place in the Loop where the condition is tested» While Loops test the condition is true before looping. In theory the code in the loop may never be executed.» Do While Loops execute the body of the loop at least once as the condition is tested at the end of the loop

106 » Challenge: Adapt your existing code so that it becomes a Do While Loop according to the template» Challenge: Add a second pop up message which informs the user the program will end once the condition in the loop has been met

107

108 » Loops are used to execute a single block of code several (or possibly hundreds) of times» While Loops test the condition is true before looping. In theory the code in the loop may never be executed.» Do While Loops execute the body of the loop at least once as the condition is tested at the end of the loop» Endless Loops can be both a good and bad thing

109 Kebot: Robot Simulator

110 » have been used extensively during the workshop thus far. However, you have yet to create your own methods from scratch» Challenge: Using the above template create a method called circledrawer. Your method will be placed above the robotcommands() method in the Jobs class. In this method code your robot to perform a Circle. Call this method from within robotcommands().

111

112 » Methods are particularly useful when you need to use the same piece of code again and again but don t want to keep repeating your code» Challenge: Create the two following methods:» Challenge: Refering only to these two methods in robotcommands(), instruct Jobs to perform a Square

113 This is exactly how almost all of the methods you have used were created. They simply contain a set of instructions that can be called over and over and vastly simplifies programs

114 » Challenge: Create a method called robotdance(). Using move(), turn() and duration() program your robot so that behaves in an unusual manner» Discuss amongst yourselves whose robot exhibits the most unusual behaviour

115

116 Kebot: Robot Simulator

117 » You have already encountered two types of Loop: While and Do While» The final JAVA loop, the For Loop, is probably the most powerful looping mechanism and has three parts: initialisation test increment/decrement

118 » The For Loop provides a way to iterate over a range of values. It is called a For Loop due to it repeatedly looping until a particular condition is satisfied.» The initialisation expression initialises the loop» When the test expression evaluates to false, the loop ends.» The increment/decrement expression is invoked after each iteration through the loop

119 » Challenge: Copy the below code into the Gates Class. Run the program» Loops help to make a programmer s life easier. The alternative to using the above loop would be: Challenge: Modify your code so that it counts UP (from 0) to 100,000. Display the count using System.out.println

120

121 » In the same way that the value of i is passed to System.out.println, this value can also be passed to the movement methods that you have used previously:» Remember, the value of i changes each time the loop is executed. In the previous example i increased each time the loop executed until 100,000 was reached:

122 » Challenge: Load the Black Hole arena. Using a For Loop instruct Gates to perform a spiral and simulate falling into a Black Hole. Code to get you started

123 » The key to solving this task is to gradually increase the amount that the robot rotates each time the loop runs» The robot need not rotate by more than 100 Degrees» The robot should move forward at a constant speed» Don t worry about trying to follow the Black Hole line precisely concentrate on trying to simulate the falling behaviour

124

125 » To write out each line of code manually» Filled 308 lines of code» 15 pages in Microsoft Word

126 Kebot: Robot Simulator

127 » To this point you have dealt with a relatively small number of variables in your code» Whilst it is possible to manage small numbers of variables, as programs expand and more information needs to be dealt with declaring individual variables becomes cumbersome» Arrays provide a neat and simple way of storing information of the same type

128 » Like declarations for variables, an array declaration has two components: the Array's type and the Array's name:» An array must then be created (by using the new operator) and the size of the array (how many Variables to create) must be declared:» An Array therefore declared as follows:

129 » During this task the robot will read a Barcode which you will drawn on screen» The robot will move from left to right storing the precise location at which it finds each line of the barcode in an Array» The Array will store the location (distance) each time it detects a line of the barcode

130 » Each element in the Array must then be given a value. One way to do this is:» Challenge: Declare an Array of type double called locationofbarcode. The Array should have 10 elements. Declare this array as a class Array. Use the Berners robot.» Declare an int called count with an initial value of 0 as a class Variable. Some of you may already have this code.

131

132 » Challenge: In the if (barcodedetected()) section of your code you need to program the following : Set the value of the Array you declared at the count position. Assign the array to store distance. Remember how to refer to array elements: Increment the count variable by one

133

134 » At the moment your code does not contain a way to report the contents of the array once the barcode has been scanned.» Challenge: Below your existing code declare an If statement which is executed if distance is greater than 2.9. Within this If use System.out.println to print each element of the Array. Using the previous example you would refer to each array element as follows:» Below where you print each Array element use the System.exit(0) command to end the program

135

136

137 » Accessing the contents of Arrays each element at a time can quickly become tiresome. Imagine accessing an Array of 100 or 1000 elements in such a manner!» For Loops are particularly helpful (and powerful) when used in conjunction with Arrays.» Remember your previous code:

138 » Challenge: Modify your code so that you use a For Loop to access and print each element of the array. The previous example should help:» You still need to use System.exit(0) to end the program and this should come after your For Loop.» You may want to add a String to your code to make it more informative.

139

140

141

142

143 Bill Gates: A founder of Microsoft Tim Berners-Lee: Father of the web and champion of IT freedom Steve Jobs: A founder of Apple and creator of imac, ipod, iphone and ipad James Gosling: Known as the father of JAVA Larry Page: One of the co-founders of Google

1007 Imperative Programming Part II

1007 Imperative Programming Part II Agenda 1007 Imperative Programming Part II We ve seen the basic ideas of sequence, iteration and selection. Now let s look at what else we need to start writing useful programs. Details now start to be

More information

CS 142 Style Guide Grading and Details

CS 142 Style Guide Grading and Details CS 142 Style Guide Grading and Details In the English language, there are many different ways to convey a message or idea: some ways are acceptable, whereas others are not. Similarly, there are acceptable

More information

If Statements, For Loops, Functions

If Statements, For Loops, Functions Fundamentals of Programming If Statements, For Loops, Functions Table of Contents Hello World Types of Variables Integers and Floats String Boolean Relational Operators Lists Conditionals If and Else Statements

More information

Control Structures in Java if-else and switch

Control Structures in Java if-else and switch Control Structures in Java if-else and switch Lecture 4 CGS 3416 Spring 2016 February 2, 2016 Control Flow Control flow refers to the specification of the order in which the individual statements, instructions

More information

Control Structures in Java if-else and switch

Control Structures in Java if-else and switch Control Structures in Java if-else and switch Lecture 4 CGS 3416 Spring 2017 January 23, 2017 Lecture 4CGS 3416 Spring 2017 Selection January 23, 2017 1 / 26 Control Flow Control flow refers to the specification

More information

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017

Control Structures. Lecture 4 COP 3014 Fall September 18, 2017 Control Structures Lecture 4 COP 3014 Fall 2017 September 18, 2017 Control Flow Control flow refers to the specification of the order in which the individual statements, instructions or function calls

More information

the NXT-G programming environment

the NXT-G programming environment 2 the NXT-G programming environment This chapter takes a close look at the NXT-G programming environment and presents a few simple programs. The NXT-G programming environment is fairly complex, with lots

More information

PROGRAMMING FUNDAMENTALS

PROGRAMMING FUNDAMENTALS PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write

More information

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet. Mr G s Java Jive #2: Yo! Our First Program With this handout you ll write your first program, which we ll call Yo. Programs, Classes, and Objects, Oh My! People regularly refer to Java as a language that

More information

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003

Control Flow. COMS W1007 Introduction to Computer Science. Christopher Conway 3 June 2003 Control Flow COMS W1007 Introduction to Computer Science Christopher Conway 3 June 2003 Overflow from Last Time: Why Types? Assembly code is typeless. You can take any 32 bits in memory, say this is an

More information

The first program: Little Crab

The first program: Little Crab Chapter 2 The first program: Little Crab topics: concepts: writing code: movement, turning, reacting to the screen edges source code, method call, parameter, sequence, if-statement In the previous chapter,

More information

CS112 Lecture: Repetition Statements

CS112 Lecture: Repetition Statements CS112 Lecture: Repetition Statements Objectives: Last revised 2/18/05 1. To explain the general form of the java while loop 2. To introduce and motivate the java do.. while loop 3. To explain the general

More information

CS112 Lecture: Loops

CS112 Lecture: Loops CS112 Lecture: Loops Objectives: Last revised 3/11/08 1. To introduce some while loop patterns 2. To introduce and motivate the java do.. while loop 3. To review the general form of the java for loop.

More information

3 The L oop Control Structure

3 The L oop Control Structure 3 The L oop Control Structure Loops The while Loop Tips and Traps More Operators The for Loop Nesting of Loops Multiple Initialisations in the for Loop The Odd Loop The break Statement The continue Statement

More information

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)...

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)... Remembering numbers (and other stuff)... Let s talk about one of the most important things in any programming language. It s called a variable. Don t let the name scare you. What it does is really simple.

More information

AP Computer Science Unit 3. Programs

AP Computer Science Unit 3. Programs AP Computer Science Unit 3. Programs For most of these programs I m asking that you to limit what you print to the screen. This will help me in quickly running some tests on your code once you submit them

More information

LAB C Translating Utility Classes

LAB C Translating Utility Classes LAB C Translating Utility Classes Perform the following groups of tasks: LabC1.s 1. Create a directory to hold the files for this lab. 2. Create and run the following two Java classes: public class IntegerMath

More information

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n)

Module 10A Lecture - 20 What is a function? Why use functions Example: power (base, n) Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Module 10A Lecture - 20 What is a function?

More information

Flow of Control. 2.1 The if Statement

Flow of Control. 2.1 The if Statement Flow of Control 2 In almost any computer program written for a scientific computing application, we need to allow the computer to execute a collection of statements if and only if some criterion is met.

More information

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.

5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. Today! Build HelloWorld yourself in BlueJ and Eclipse. Look at all the Java keywords. Primitive Types. HelloWorld in BlueJ 1. Find BlueJ in the start menu, but start the Select VM program instead (you

More information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 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

All copyrights reserved - KV NAD, Aluva. Dinesh Kumar Ram PGT(CS) KV NAD Aluva

All copyrights reserved - KV NAD, Aluva. Dinesh Kumar Ram PGT(CS) KV NAD Aluva All copyrights reserved - KV NAD, Aluva Dinesh Kumar Ram PGT(CS) KV NAD Aluva Overview Looping Introduction While loops Syntax Examples Points to Observe Infinite Loops Examples using while loops do..

More information

cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 topics: introduction to java, part 1

cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 topics: introduction to java, part 1 topics: introduction to java, part 1 cis20.1 design and implementation of software applications I fall 2007 lecture # I.2 cis20.1-fall2007-sklar-leci.2 1 Java. Java is an object-oriented language: it is

More information

Coding Workshop. Learning to Program with an Arduino. Lecture Notes. Programming Introduction Values Assignment Arithmetic.

Coding Workshop. Learning to Program with an Arduino. Lecture Notes. Programming Introduction Values Assignment Arithmetic. Coding Workshop Learning to Program with an Arduino Lecture Notes Table of Contents Programming ntroduction Values Assignment Arithmetic Control Tests f Blocks For Blocks Functions Arduino Main Functions

More information

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0. L J Howell UX Software Ver. 1.0

VISUAL GUIDE to. RX Scripting. for Roulette Xtreme - System Designer 2.0. L J Howell UX Software Ver. 1.0 VISUAL GUIDE to RX Scripting for Roulette Xtreme - System Designer 2.0 L J Howell UX Software 2009 Ver. 1.0 TABLE OF CONTENTS INTRODUCTION...ii What is this book about?... iii How to use this book... iii

More information

Object-Oriented Programming

Object-Oriented Programming Object-Oriented Programming Java Syntax Program Structure Variables and basic data types. Industry standard naming conventions. Java syntax and coding conventions If Then Else Case statements Looping (for,

More information

CT 229 Java Syntax Continued

CT 229 Java Syntax Continued CT 229 Java Syntax Continued 29/09/2006 CT229 Lab Assignments One Week Extension for Lab Assignment 1. Due Date: Oct 8 th Before submission make sure that the name of each.java file matches the name given

More information

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Scan Converting Lines, Circles and Ellipses Hello everybody, welcome again

More information

LOOPS. Repetition using the while statement

LOOPS. Repetition using the while statement 1 LOOPS Loops are an extremely useful feature in any programming language. They allow you to direct the computer to execute certain statements more than once. In Python, there are two kinds of loops: while

More information

CS50 Supersection (for those less comfortable)

CS50 Supersection (for those less comfortable) CS50 Supersection (for those less comfortable) Friday, September 8, 2017 3 4pm, Science Center C Maria Zlatkova, Doug Lloyd Today s Topics Setting up CS50 IDE Variables and Data Types Conditions Boolean

More information

REPETITION CONTROL STRUCTURE LOGO

REPETITION CONTROL STRUCTURE LOGO CSC 128: FUNDAMENTALS OF COMPUTER PROBLEM SOLVING REPETITION CONTROL STRUCTURE 1 Contents 1 Introduction 2 for loop 3 while loop 4 do while loop 2 Introduction It is used when a statement or a block of

More information

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018

Object-oriented programming. and data-structures CS/ENGRD 2110 SUMMER 2018 Object-oriented programming 1 and data-structures CS/ENGRD 2110 SUMMER 2018 Lecture 1: Types and Control Flow http://courses.cs.cornell.edu/cs2110/2018su Lecture 1 Outline 2 Languages Overview Imperative

More information

Units 0 to 4 Groovy: Introduction upto Arrays Revision Guide

Units 0 to 4 Groovy: Introduction upto Arrays Revision Guide Units 0 to 4 Groovy: Introduction upto Arrays Revision Guide Second Year Edition Name: Tutorial Group: Groovy can be obtained freely by going to http://groovy-lang.org/download Page 1 of 8 Variables Variables

More information

Introduction to Java & Fundamental Data Types

Introduction to Java & Fundamental Data Types Introduction to Java & Fundamental Data Types LECTURER: ATHENA TOUMBOURI How to Create a New Java Project in Eclipse Eclipse is one of the most popular development environments for Java, as it contains

More information

CHAPTER 7 ARRAYS: SETS OF SIMILAR DATA ITEMS

CHAPTER 7 ARRAYS: SETS OF SIMILAR DATA ITEMS CHAPTER 7 ARRAYS: SETS OF SIMILAR DATA ITEMS Computers process information and usually they need to process masses of information. In previous chapters we have studied programs that contain a few variables

More information

G. Tardiani RoboCup Rescue. EV3 Workshop Part 1 Introduction to RobotC

G. Tardiani RoboCup Rescue. EV3 Workshop Part 1 Introduction to RobotC RoboCup Rescue EV3 Workshop Part 1 Introduction to RobotC Why use RobotC? RobotC is a more traditional text based programming language The more compact coding editor allows for large programs to be easily

More information

COMP-202: Foundations of Programming. Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015

COMP-202: Foundations of Programming. Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015 COMP-202: Foundations of Programming Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015 Announcements Midterm Exams on 4 th of June (12:35 14:35) Room allocation will be announced soon

More information

The viewer works in Chrome, Edge, Firefox, and Safari. The web address for the workshop is https://nclab.com/karel-workshop/

The viewer works in Chrome, Edge, Firefox, and Safari. The web address for the workshop is https://nclab.com/karel-workshop/ LOGIC WITH KAREL INTRODUCTION TO CODING AND LOGICAL REASONING Karel is a robot who runs around a 12 x 15 maze, collecting and placing objects. That may sound simple, but Karel teaches all kinds of sophisticated

More information

The for Loop. Lesson 11

The for Loop. Lesson 11 The for Loop Lesson 11 Have you ever played Tetris? You know that the game never truly ends. Blocks continue to fall one at a time, increasing in speed as you go up in levels, until the game breaks from

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Software and Programming 1

Software and Programming 1 Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon

More information

CHAPTER 5 VARIABLES AND OTHER BASIC ELEMENTS IN JAVA PROGRAMS

CHAPTER 5 VARIABLES AND OTHER BASIC ELEMENTS IN JAVA PROGRAMS These are sample pages from Kari Laitinen s book "A Natural Introduction to Computer Programming with Java". For more information, please visit http://www.naturalprogramming.com/javabook.html CHAPTER 5

More information

Mr. Monroe s Guide to Mastering Java Syntax

Mr. Monroe s Guide to Mastering Java Syntax Mr. Monroe s Guide to Mastering Java Syntax Getting Started with Java 1. Download and install the official JDK (Java Development Kit). 2. Download an IDE (Integrated Development Environment), like BlueJ.

More information

CITS2401 Computer Analysis & Visualisation

CITS2401 Computer Analysis & Visualisation FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Topic 3 Introduction to Matlab Material from MATLAB for

More information

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Problem Solving through Programming In C Prof. Anupam Basu Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture 18 Switch Statement (Contd.) And Introduction to

More information

1 Getting started with Processing

1 Getting started with Processing cisc3665, fall 2011, lab I.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For

More information

Control Structures. Code can be purely arithmetic assignments. At some point we will need some kind of control or decision making process to occur

Control Structures. Code can be purely arithmetic assignments. At some point we will need some kind of control or decision making process to occur Control Structures Code can be purely arithmetic assignments At some point we will need some kind of control or decision making process to occur C uses the if keyword as part of it s control structure

More information

School of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15

School of Computer Science CPS109 Course Notes 5 Alexander Ferworn Updated Fall 15 Table of Contents 1 INTRODUCTION... 1 2 IF... 1 2.1 BOOLEAN EXPRESSIONS... 3 2.2 BLOCKS... 3 2.3 IF-ELSE... 4 2.4 NESTING... 5 3 SWITCH (SOMETIMES KNOWN AS CASE )... 6 3.1 A BIT ABOUT BREAK... 7 4 CONDITIONAL

More information

Introduction to the Java Basics: Control Flow Statements

Introduction to the Java Basics: Control Flow Statements Lesson 3: Introduction to the Java Basics: Control Flow Statements Repetition Structures THEORY Variable Assignment You can only assign a value to a variable that is consistent with the variable s declared

More information

egrapher Language Reference Manual

egrapher Language Reference Manual egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction

More information

CS 231 Data Structures and Algorithms, Fall 2016

CS 231 Data Structures and Algorithms, Fall 2016 CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard

More information

Introduction to Programming using C++

Introduction to Programming using C++ Introduction to Programming using C++ Lecture One: Getting Started Carl Gwilliam gwilliam@hep.ph.liv.ac.uk http://hep.ph.liv.ac.uk/~gwilliam/cppcourse Course Prerequisites What you should already know

More information

Introduction. C provides two styles of flow control:

Introduction. C provides two styles of flow control: Introduction C provides two styles of flow control: Branching Looping Branching is deciding what actions to take and looping is deciding how many times to take a certain action. Branching constructs: if

More information

More Programming Constructs -- Introduction

More Programming Constructs -- Introduction More Programming Constructs -- Introduction We can now examine some additional programming concepts and constructs Chapter 5 focuses on: internal data representation conversions between one data type and

More information

Outline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors

Outline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors Outline Overview history and advantage how to: program, compile and execute 8 data types 3 types of errors Control statements Selection and repetition statements Classes and methods methods... 2 Oak A

More information

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2

Python for Analytics. Python Fundamentals RSI Chapters 1 and 2 Python for Analytics Python Fundamentals RSI Chapters 1 and 2 Learning Objectives Theory: You should be able to explain... General programming terms like source code, interpreter, compiler, object code,

More information

C++ for Java Programmers

C++ for Java Programmers Basics all Finished! Everything we have covered so far: Lecture 5 Operators Variables Arrays Null Terminated Strings Structs Functions 1 2 45 mins of pure fun Introduction Today: Pointers Pointers Even

More information

COMP-202 Unit 4: Programming With Iterations. CONTENTS: The while and for statements

COMP-202 Unit 4: Programming With Iterations. CONTENTS: The while and for statements COMP-202 Unit 4: Programming With Iterations CONTENTS: The while and for statements Introduction (1) Suppose we want to write a program to be used in cash registers in stores to compute the amount of money

More information

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan Lecture 08-1 Programming in C++ PART 1 By Assistant Professor Dr. Ali Kattan 1 The Conditional Operator The conditional operator is similar to the if..else statement but has a shorter format. This is useful

More information

COSC 2P91. Bringing it all together... Week 4b. Brock University. Brock University (Week 4b) Bringing it all together... 1 / 22

COSC 2P91. Bringing it all together... Week 4b. Brock University. Brock University (Week 4b) Bringing it all together... 1 / 22 COSC 2P91 Bringing it all together... Week 4b Brock University Brock University (Week 4b) Bringing it all together... 1 / 22 A note on practicality and program design... Writing a single, monolithic source

More information

5 The Control Structure Diagram (CSD)

5 The Control Structure Diagram (CSD) 5 The Control Structure Diagram (CSD) The Control Structure Diagram (CSD) is an algorithmic level diagram intended to improve the comprehensibility of source code by clearly depicting control constructs,

More information

int j = 0, sum = 0; for (j = 3; j <= 79; j++) { sum = sum + j; System.out.println(sum); //Show the progress as we iterate thru the loop.

int j = 0, sum = 0; for (j = 3; j <= 79; j++) { sum = sum + j; System.out.println(sum); //Show the progress as we iterate thru the loop. 11-1 One of the most important structures in Java is the -loop. A loop is basically a block of code that is with certain rules about how to start and how to end the process. Suppose we want to sum up all

More information

VARIABLES AND TYPES CITS1001

VARIABLES AND TYPES CITS1001 VARIABLES AND TYPES CITS1001 Scope of this lecture Types in Java the eight primitive types the unlimited number of object types Values and References The Golden Rule Primitive types Every piece of data

More information

Language Reference Manual

Language Reference Manual ALACS Language Reference Manual Manager: Gabriel Lopez (gal2129) Language Guru: Gabriel Kramer-Garcia (glk2110) System Architect: Candace Johnson (crj2121) Tester: Terence Jacobs (tj2316) Table of Contents

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

Starting with a great calculator... Variables. Comments. Topic 5: Introduction to Programming in Matlab CSSE, UWA

Starting with a great calculator... Variables. Comments. Topic 5: Introduction to Programming in Matlab CSSE, UWA Starting with a great calculator... Topic 5: Introduction to Programming in Matlab CSSE, UWA! MATLAB is a high level language that allows you to perform calculations on numbers, or arrays of numbers, in

More information

COMS 469: Interactive Media II

COMS 469: Interactive Media II COMS 469: Interactive Media II Agenda Review Data Types & Variables Decisions, Loops, and Functions Review gunkelweb.com/coms469 Review Basic Terminology Computer Languages Interpreted vs. Compiled Client

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

BASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment

More information

Sri Vidya College of Engineering & Technology

Sri Vidya College of Engineering & Technology UNIT I INTRODUCTION TO OOP AND FUNDAMENTALS OF JAVA 1. Define OOP. Part A Object-Oriented Programming (OOP) is a methodology or paradigm to design a program using classes and objects. It simplifies the

More information

My First iphone App (for Xcode version 6.4)

My First iphone App (for Xcode version 6.4) My First iphone App (for Xcode version 6.4) 1. Tutorial Overview In this tutorial, you re going to create a very simple application on the iphone or ipod Touch. It has a text field, a label, and a button

More information

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics Assignment 1: Turtle Graphics Page 1 600.112: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics Peter H. Fröhlich phf@cs.jhu.edu Joanne Selinski joanne@cs.jhu.edu Due Date: Wednesdays

More information

Slide 1 CS 170 Java Programming 1 The Switch Duration: 00:00:46 Advance mode: Auto

Slide 1 CS 170 Java Programming 1 The Switch Duration: 00:00:46 Advance mode: Auto CS 170 Java Programming 1 The Switch Slide 1 CS 170 Java Programming 1 The Switch Duration: 00:00:46 Menu-Style Code With ladder-style if-else else-if, you might sometimes find yourself writing menu-style

More information

Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos.

Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos. Lecture 2: Variables and Operators AITI Nigeria Summer 2012 University of Lagos. Agenda Variables Types Naming Assignment Data Types Type casting Operators Declaring Variables in Java type name; Variables

More information

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible)

Multiple Choice (Questions 1 13) 26 Points Select all correct answers (multiple correct answers are possible) Name Closed notes, book and neighbor. If you have any questions ask them. Notes: Segment of code necessary C++ statements to perform the action described not a complete program Program a complete C++ program

More information

Procedures: Algorithms and Abstraction

Procedures: Algorithms and Abstraction Procedures: Algorithms and Abstraction 5 5.1 Objectives After completing this module, a student should be able to: Read and understand simple NetLogo models. Make changes to NetLogo procedures and predict

More information

C++ Data Types. 1 Simple C++ Data Types 2. 3 Numeric Types Integers (whole numbers) Decimal Numbers... 5

C++ Data Types. 1 Simple C++ Data Types 2. 3 Numeric Types Integers (whole numbers) Decimal Numbers... 5 C++ Data Types Contents 1 Simple C++ Data Types 2 2 Quick Note About Representations 3 3 Numeric Types 4 3.1 Integers (whole numbers)............................................ 4 3.2 Decimal Numbers.................................................

More information

SCRATCH MODULE 3: NUMBER CONVERSIONS

SCRATCH MODULE 3: NUMBER CONVERSIONS SCRATCH MODULE 3: NUMBER CONVERSIONS INTRODUCTION The purpose of this module is to experiment with user interactions, error checking input, and number conversion algorithms in Scratch. We will be exploring

More information

YOLOP Language Reference Manual

YOLOP Language Reference Manual YOLOP Language Reference Manual Sasha McIntosh, Jonathan Liu & Lisa Li sam2270, jl3516 and ll2768 1. Introduction YOLOP (Your Octothorpean Language for Optical Processing) is an image manipulation language

More information

Unit 1 Lesson 4. Introduction to Control Statements

Unit 1 Lesson 4. Introduction to Control Statements Unit 1 Lesson 4 Introduction to Control Statements Essential Question: How are control loops used to alter the execution flow of a program? Lesson 4: Introduction to Control Statements Objectives: Use

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

Design Programming DECO2011

Design Programming DECO2011 Design Programming DECO2011 Rob Saunders web: http://www.arch.usyd.edu.au/~rob e-mail: rob@arch.usyd.edu.au office: Room 274, Wilkinson Building Data, Variables and Flow Control What is a Variable? Computers

More information

>print "hello" [a command in the Python programming language]

>print hello [a command in the Python programming language] What Is Programming? Programming is the process of writing the code of computer programs. A program is just a sequence of instructions that a computer is able to read and execute, to make something happen,

More information

Lab 1 Implementing a Simon Says Game

Lab 1 Implementing a Simon Says Game ECE2049 Embedded Computing in Engineering Design Lab 1 Implementing a Simon Says Game In the late 1970s and early 1980s, one of the first and most popular electronic games was Simon by Milton Bradley.

More information

Learning to use the drawing tools

Learning to use the drawing tools Create a blank slide This module was developed for Office 2000 and 2001, but although there are cosmetic changes in the appearance of some of the tools, the basic functionality is the same in Powerpoint

More information

Accelerating Information Technology Innovation

Accelerating Information Technology Innovation Accelerating Information Technology Innovation http://aiti.mit.edu Cali, Colombia Summer 2012 Lesson 02 Variables and Operators Agenda Variables Types Naming Assignment Data Types Type casting Operators

More information

Ticket Machine Project(s)

Ticket Machine Project(s) Ticket Machine Project(s) Understanding the basic contents of classes Produced by: Dr. Siobhán Drohan (based on Chapter 2, Objects First with Java - A Practical Introduction using BlueJ, David J. Barnes,

More information

Java is an objet-oriented programming language providing features that support

Java is an objet-oriented programming language providing features that support Java Essentials CSCI 136: Spring 2018 Handout 2 February 2 Language Basics Java is an objet-oriented programming language providing features that support Data abstraction Code reuse Modular development

More information

Repetition Through Recursion

Repetition Through Recursion Fundamentals of Computer Science I (CS151.02 2007S) Repetition Through Recursion Summary: In many algorithms, you want to do things again and again and again. For example, you might want to do something

More information

Objectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators

Objectives. Chapter 4: Control Structures I (Selection) Objectives (cont d.) Control Structures. Control Structures (cont d.) Relational Operators Objectives Chapter 4: Control Structures I (Selection) In this chapter, you will: Learn about control structures Examine relational and logical operators Explore how to form and evaluate logical (Boolean)

More information

Python as a First Programming Language Justin Stevens Giselle Serate Davidson Academy of Nevada. March 6th, 2016

Python as a First Programming Language Justin Stevens Giselle Serate Davidson Academy of Nevada. March 6th, 2016 Python as a First Programming Language Justin Stevens Giselle Serate Davidson Academy of Nevada Under Supervision of: Dr. Richard Kelley Chief Engineer, NAASIC March 6th, 2016 Science Technology Engineering

More information

The compiler is spewing error messages.

The compiler is spewing error messages. Appendix B Debugging There are a few different kinds of errors that can occur in a program, and it is useful to distinguish between them in order to track them down more quickly. Compile-time errors are

More information

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal Lesson Goals Understand the basic constructs of a Java Program Understand how to use basic identifiers Understand simple Java data types

More information

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM

CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM CPSC 121 Some Sample Questions for the Final Exam Tuesday, April 15, 2014, 8:30AM Name: Student ID: Signature: Section (circle one): George Steve Your signature acknowledges your understanding of and agreement

More information

EdPy worksheets Student worksheets and activity sheets

EdPy worksheets Student worksheets and activity sheets EdPy worksheets Student worksheets and activity sheets For more STEAM Educational Products, please visit www.hamiltonbuhl.com Never-Ending Learning Innovation The EdPy Lesson Plans Set by Brenton O Brien,

More information

Scheme of work Cambridge International AS & A Level Computing (9691)

Scheme of work Cambridge International AS & A Level Computing (9691) Scheme of work Cambridge International AS & A Level Computing (9691) Unit 2: Practical programming techniques Recommended prior knowledge Students beginning this course are not expected to have studied

More information

On the Web sun.com/aboutsun/comm_invest STAROFFICE 8 DRAW

On the Web sun.com/aboutsun/comm_invest STAROFFICE 8 DRAW STAROFFICE 8 DRAW Graphics They say a picture is worth a thousand words. Pictures are often used along with our words for good reason. They help communicate our thoughts. They give extra information that

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 8: SEP. 29TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 8: SEP. 29TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 8: SEP. 29TH INSTRUCTOR: JIAYIN WANG 1 Notice Prepare the Weekly Quiz The weekly quiz is for the knowledge we learned in the previous week (both the

More information

CpSc 1111 Lab 4 Part a Flow Control, Branching, and Formatting

CpSc 1111 Lab 4 Part a Flow Control, Branching, and Formatting CpSc 1111 Lab 4 Part a Flow Control, Branching, and Formatting Your factors.c and multtable.c files are due by Wednesday, 11:59 pm, to be submitted on the SoC handin page at http://handin.cs.clemson.edu.

More information

CS112 Lecture: Primitive Types, Operators, Strings

CS112 Lecture: Primitive Types, Operators, Strings CS112 Lecture: Primitive Types, Operators, Strings Last revised 1/24/06 Objectives: 1. To explain the fundamental distinction between primitive types and reference types, and to introduce the Java primitive

More information