Alice and Java Unit 7 1. Day 1  Objective: Gain an introduction to Java and Eclipse  Essential skill: DM-1: Use technology to advance critical thinking.

Slides:



Advertisements
Similar presentations
Overloading Having more than one method with the same name is known as overloading. Overloading is legal in Java as long as each version takes different.
Advertisements

CPSC 388 – Compiler Design and Construction
1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com.
Introduction to Java.
Team 5220 Roboknights. Outline  Getting Started  Hardware Setup/Wiring  Software Setup/Pragmas  Programming with RobotC  Grammar/Syntax  Basic Statements.
Lecture 2 Calling and Defining Methods in Java. Introduction ●Calling and defining methods ●Declaring and defining a class ●Instances of a class ●The.
Classes  All code in a Java program is part of a class  A class has two purposes  Provide functions to do work for the programmer  Represent data.
2/18/2008ITK 1681 Feb. 20, Wed. 8:00 – 9:30 pm STV Closed book, notes, and no computer is allowed. 2.Everyone is allowed to bring a self- prepared.
VEX and Robot C Chris Patterson Presented by Modified by J. Andazola.
IT151: Introduction to Programming
Your First Java Program: HelloWorld.java
1 CS101 Introduction to Computing Lecture 23 Flow Control & Loops (Web Development Lecture 8)
Week 9: Methods 1.  We have written lots of code so far  It has all been inside of the main() method  What about a big program?  The main() method.
C++ Programming: From Problem Analysis to Program Design, Second Edition Chapter 6: User-Defined Functions I.
26-Jun-15 Methods. About methods A method is a named group of declarations and statements You execute those declarations and statements by calling the.
Chapter 6: User-Defined Functions I
Programming Part 1 Armond R. Smith Zhenying Wu. Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types.
Unit 2: Java Introduction to Programming 2.1 Initial Example.
LESSON 2 CREATING A JAVA APPLICATION JAVA PROGRAMMING Compiled By: Edwin O. Okech [Tutor, Amoud University]
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com.
Instructor: Craig Duckett Assignment 1 Due Lecture 5 by MIDNIGHT – NEXT – NEXT Tuesday, October 13 th I will double dog try to.
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Nonvisual Arrays and Recursion by Chris Brown under Prof. Susan Rodger Duke University June 2012.
The Java Programming Language
Methods in Java CSC1401. Overview In this session, we are going to see how to create class-level methods in Java.
Board Activity Find your seat on the seating chart Login – Remember your login is your first initial your last name and the last three numbers of your.
Mr. Dave Clausen1 La Cañada High School Chapter 6: Repetition Statements.
Variables and Functions. Open your Encoder program Let’s begin by opening the “Labyrinth Auto Straight” code. Save this file as Labyrinth with variables.
CPS120: Introduction to Computer Science Decision Making in Programs.
Introduction to programming in the Java programming language.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 6: User-Defined Functions I.
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
1 FUNCTIONS - I Chapter 5 Functions help us write more complex programs.
1 Karel J Robot OOP approach to learning computer science “Its study involves development of the ability to abstract the essential features of a problem.
1 Structure of a C Program (continued) Presentation original from Dr. Turner’s class USF - COP C for Engineers Summer 2008.
Chapter 5.  We’ve been using UrRobot – knows only 5 things  Let’s now use a new type of Robot: Robot!  i.e. – public class MileMover extends Robot.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 6: User-Defined Functions I.
Lecture 08. Since all Java program activity occurs within a class, we have been using classes since the start of this lecture series. A class is a template.
Functions Math library functions Function definition Function invocation Argument passing Scope of an variable Programming 1 DCT 1033.
1 Class 1 Lecture Topic Concepts, Definitions and Examples.
Programming in Karel Eric Roberts CS 106A January 6, 2016.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Chapter 3: User-Defined Functions I
Instructor: Craig Duckett Assignment 1 Due Lecture 5 by MIDNIGHT – NEXT – NEXT Wednesday, January 20 th one week from today I will.
C++ Programming: From Problem Analysis to Program Design, Fourth Edition Chapter 6: User-Defined Functions I.
Repetition Statements (Loops). 2 Introduction to Loops We all know that much of the work a computer does is repeated many times. When a program repeats.
1 Review for Midterm 2 Aaron Bloomfield CS 101-E.
Jeopardy $100 VariablesErrorsLoops Classes and Objects Program Structure $200 $300 $400 $500 $400 $300 $200 $100 $500 $400 $300 $200 $100 $500 $400 $300.
Programming for Interactivity Professor Bill Tomlinson Tuesday & Wednesday 6:00-7:50pm Fall 2005.
Compiler Errors Syntax error Lexical Can not resolve/find symbol Can not be applied Execution error Oh wait, a run time error Intent error It ran, but.
Programming Basics - RobotC Introduction to Robotics.
Introduction to Programming G50PRO University of Nottingham Unit 6 : Control Flow Statements 2 Paul Tennent
BIT 115: Introduction To Programming Professor: Dr. Baba Kofi Weusijana Pronounced Bah-bah Co-fee Way-ou-see-jah-nah Call him “Baba” or “Dr. Weusijana”
Comp1004: Introduction III Java. Content How Java Works: The JVM Writing a Class in Java – Class – Member Variables – Method – Statement Magic incantations.
Computer Programming Your First Java Program: HelloWorld.java.
The eclipse IDE IDE = “Integrated Development Environment”
Dept of Computer Science University of Maryland College Park
Chapter 6: User-Defined Functions I
CompSci 230 Software Construction
Hands-On Ethical Hacking and Network Defense
Programming Basics - RobotC
A programming language
Introduction to javadoc
Introduction to Programming
LOOPS The loop is the control structure we use to specify that a statement or group of statements is to be repeatedly executed. Java provides three kinds.
Introduction to Programming
Methods/Functions.
How to Run a Java Program
Presentation transcript:

Alice and Java Unit 7 1

Day 1  Objective: Gain an introduction to Java and Eclipse  Essential skill: DM-1: Use technology to advance critical thinking and construct knowledge  Website: For extra resources, check out the website 2

Lets get started!  First, create a folder called “YourNameWorkspace”  Copy Karl from my T-drive into your workspace  Now open up Eclipse on your computer!  You will be prompted to Select a Workspace—find the one you just created! 3

Lets Create our First Project  File  New  Java Project  Name this project “Karl” to match the name of the folder  You will now have all of Karl’s Java Files loaded into your project  The top will be all your Java Files  The System Library is all the prebuilt java code that you can use  The bottom will be all your text and image files 4

Karl  When you run the program, you should see a maze with a robot  Lets look at why this happens:  To call the methods, we always will have it in the form: object.methodName(arguments);  object refers to the class  There are no arguments for these methods, but you still need parentheses 5

6 Karl the Robot - Methods  Robot.move();before: front must be clear after: robot has advanced 1 space  Robot.turnLeft();after: robot has rotated 90 degrees counter-clockwise  Robot.makeDark();before: must be on light after: current square is now dark  Robot.makeLight();before: must be on dark after: current square is not light  Robot.load(“filename.txt”);loads a file with the robot on a grid  Robot.onDark()returns True if the robot is currently on a dark square returns False if the robot is currently on a light square  Robot.frontIsClear()returns True if the robot is facing an open space returns False if the robot is facing a wall

Classwork  Explore the robot functions!  Write the code to have the robot complete the maze  Make sure to put this in the Karl Java File (the Karl tab at the top of eclipse) and under the completeMaze method 7

Day 2  Objective: Understand Robot Methods  Essential skill: DM-1: Use technology to advance critical thinking and construct knowledge 8

Programming!  Two Parts  Logic: organization, problem solving, breaking big tasks into smaller parts  Syntax: rules, words, curly braces, semi-colons, etc  Need to practice and learn logic  Can memorize syntax 9

Methods  Lets open Eclipse and write a turnRight() method!  Make sure we Java doc! /** Write your comments here. Make sure to explain what your method will do any what parameters are necessary. It will show up when you hover over the method and this is very useful for others to understand the methods you are writing */  After writing the turnRight() method, the code for completing the maze is a lot less work for us to write  Make sure to write methods to keep your code neat and organized  It’s more work for the compiler, but less work for us! 10

Other methods  Lets write two more methods that we might like to have  turnAround()  backUp()  Now lets try another challenge  Load “stairs.txt” instead of “maze.txt”  How can we write a method to clear the stairs 11

Classwork  Write a method that will light all the blocks 12

Day 3  Objective: Understand If/Else statements  Essential skill: DM-1: Use technology to advance critical thinking and construct knowledge 13

Review Syntax Rules  Calling a method:  fileName(class).methodName();  Creating a class:  public className { method declarations }  Method declarations:  public static void methodName() { statements } 14

Problem solving  Break complex problem into smaller pieces  Name the pieces and think in terms of these names  This is called Abstraction 15

Lets revisit cleanStairs  What if the stairs were different?  Open board1 in Eclipse and lets create another staircase  Using an if/else statement, lets tests to see if the front is clear  If/else structure: 16

Day 4-5: Project

Day 6  Objective: Boolean Expressions  Essential skill: DM-1: Use technology to advance critical thinking and construct knowledge 18

19

Day 7  Objective: While statements  Essential skill: DM-1: Use technology to advance critical thinking and construct knowledge 20

21

Day 8  Objective: Understand Variables  Essential skill: DM-1: Use technology to advance critical thinking and construct knowledge 22

23

Days 9-13: Project

Day 14: Quiz 25