Programming Part 1 Armond R. Smith Zhenying Wu. Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types.

Slides:



Advertisements
Similar presentations
AP Computer Science Anthony Keen. Computer 101 What happens when you turn a computer on? –BIOS tries to start a system loader –A system loader tries to.
Advertisements

Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
08/2012Tanya Mishra1 EASYC for VEX Cortex Llano Estacado RoboRaiders FRC Team 1817.
Q1 Review. Other News US News top CS Universities global-universities/computer- science?int=994b08.
Team 5220 Roboknights. Outline  Getting Started  Hardware Setup/Wiring  Software Setup/Pragmas  Programming with RobotC  Grammar/Syntax  Basic Statements.
Week 2: Primitive Data Types 1.  Programming in Java  Everything goes inside a class  The main() method is the starting point for executing instructions.
1 Java Basics. 2 Compiling A “compiler” is a program that translates from one language to another Typically from easy-to-read to fast-to-run e.g. from.
Declaring Variables You must first declare a variable before you can use it! Declaring involves: – Establishing the variable’s spot in memory – Specifying.
Some basic I/O.
Fundamental Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
COMP 14: Primitive Data and Objects May 24, 2000 Nick Vallidis.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
Week #2 Java Programming. Enable Line Numbering in Eclipse Open Eclipse, then go to: Window -> Preferences -> General -> Editors -> Text Editors -> Check.
Hello AP Computer Science!. What are some of the things that you have used computers for?
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
The Java Programming Language
CSC204 – Programming I Lecture 4 August 28, 2002.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Lecture 2: Classes and Objects, using Scanner and String.
JAVA BASICS: Variables and References SYNTAX, ERRORS, AND DEBUGGING.
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.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
 JAVA Compilation and Interpretation  JAVA Platform Independence  Building First JAVA Program  Escapes Sequences  Display text with printf  Data.
Variables and Functions. Open your Encoder program Let’s begin by opening the “Labyrinth Auto Straight” code. Save this file as Labyrinth with variables.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
Session Three Review & Conditional Control Flow. Java File Hierarchy Projects Packages Classes Methods.
Java development environment and Review of Java. Eclipse TM Intergrated Development Environment (IDE) Running Eclipse: Warning: Never check the “Use this.
Review, Pseudocode, Flow Charting, and Storyboarding.
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals. Procedural Constructs -
JAVA Practical Creating our first program 2. Source code file 3. Class file 4. Understanding the different parts of our program 5. Escape characters.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
VARIABLES Programmes work by manipulating data placed in memory. The data can be numbers, text, objects, pointers to other memory areas, and more besides.
CS101: Introduction to Computer Science Slides adapted from Sedgewick and Wayne Copyright © Your First Java.
Hello Computer Science!. Below is an example of a Hello World program in JAVA. While it is only three lines of code, there are many things that are happening.
1 Basic Java Constructs and Data Types – Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C.
Developed at Sun Microsystems in 1991 James Gosling, initially named “OAK” Formally announced java in 1995 Object oriented and cant write procedural.
By Mr. Muhammad Pervez Akhtar
Reference Learning Java DDC publishing Herst, Yamauchi, Adler COP 3331 Object Oriented Analysis and Design Java Part I.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 3 – Introduction to C# Programming Outline 3.1 Introduction 3.2 Simple Program: Printing a Line.
Java: Variables and Methods By Joshua Li Created for the allAboutJavaClasses wikispace.
Java Basics. Tokens: 1.Keywords int test12 = 10, i; int TEst12 = 20; Int keyword is used to declare integer variables All Key words are lower case java.
Programming for Interactivity Professor Bill Tomlinson Tuesday & Wednesday 6:00-7:50pm Fall 2005.
SUMMARY OF CHAPTER 2: JAVA FUNDAMENTS STARTING OUT WITH JAVA: OBJECTS Parts of a Java Program.
CS0007: Introduction to Computer Programming Primitive Data Types and Arithmetic Operations.
Lecture 3: More Java Basics Michael Hsu CSULA. Recall From Lecture Two  Write a basic program in Java  The process of writing, compiling, and running.
Eastside Robotics Alliance / Newport Robotics Group 1 T/Th, 6:30 – 8:30 PM Big Picture School Day 3 · 10/9/2014.
Session Three Review & Conditional Control Flow. Java File Hierarchy Projects Packages Classes Methods.
Information and Computer Sciences University of Hawaii, Manoa
The eclipse IDE IDE = “Integrated Development Environment”
Week 2 - Wednesday CS 121.
Basic Introduction to C#
Lecture 2 D&D Chapter 2 & Intro to Eclipse IDE Date.
Working with Java.
USING ECLIPSE TO CREATE HELLO WORLD
Computer Programming Methodology Introduction to Java
Subroutines Idea: useful code can be saved and re-used, with different data values Example: Our function to find the largest element of an array might.
Statements, Comments & Simple Arithmetic
Introduction to Java Programming
An Introduction to Java – Part I, language basics
Tonga Institute of Higher Education
<INSERT_WITTY_QUOTE_HERE>
PHP.
Chapter 3 – Introduction to C# Programming
CS2011 Introduction to Programming I Elementary Programming
Fundamental OOP Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
In this class, we will cover:
Just Enough Java 17-May-19.
Introduction to java Part I By Shenglan Zhang.
Presentation transcript:

Programming Part 1 Armond R. Smith Zhenying Wu

Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types o Modifiers o Basic Structure ● Understanding Logic ● Reading / Writing Code ● Object Oriented Programming o Motors, Servos, etc.

What this class is ● In this class you will NOT learn how to write code. ● This class is about learning how to read code and use your resources as a programmer ● In order to go to advanced you need to take this class

Things that ARE NOT in FRC ● #pragma is gone (YES!) o but you will set up your motors, servos etc differently ● The “task” function does not exist ● strings are easier to use

How is it The Same as FTC? ● Logic does not change ● Same Basic Structure (Data Types) ● Still case sensitive o If you mess up one letters case (capitalization) you may not compile correctly.

How is it Different from FTC ● FTC: Robot C ; FRC: JAVA ● Larger Scale Robot = Larger Scale Coding ● New Data Types ● New Modifiers ● “Object Oriented Programming” Warning: You will have way more things to pay attention to and remember about your code.

RESOURCES!

Resources you can use to help you ● API/Libraries o Application Programming Interface: Your stock methods and functions. ● Chief Delphi ● Mentors ● Your peers ● Java for Dummies = Your New Bible

Things We Use Here ● We use the IDE called “Netbeans” o For this presentation I'm using “Eclipse” ● The main API we use is provided by FIRST o If you know how to, you can manipulate this infinite ways. ● The API links us to the Drivers Station directly o You can learn to use it in part 2.

FTC Recap! ● int -- Integer ● boolean -- True or False ● float -- Decimal ● string -- “A string of text like this” ● void -- returns no value You can still use all of these in JAVA

New Data Types! ● double -- decimal o More accurate than float ● long -- decimal o More accurate than double (use for timing: Java uses nanoSeconds)

Basic Things ● Comments o Does not affect the code! o “//” everything on the line after this will be a comment o “/* */” everything in between the asterisks will be comments ● Semicolons (;) o Semicolons are line breaks. They are like periods in english.

Starting Up ● task main ● public static void main(String[] args) What does this mean you ask? Lets Break it down

public static void main(String[] args) public -- The method can be seen by other files outside of the package (folder) static -- The method is global; there can only be one of this method void -- it returns no value main -- is the first method looked at by the code String[] args -- Just accept that it exists, you don't have to worry about it, just remember it when you code.

Hello World 1.Create new class file called “HelloWorld” 2.In the class, make public static void main (String[] args) method 3.In that method put in “System.out.println(“Hello, world”)” This code prints in the console “Hello World” and then ends the code.

Modifiers: What is a modifier? ● “public” and “static” are examples of Modifiers ● Modifiers edit the type of a variable or method. ● Can change visibility of variables to other variables ● Can change how variables interact with each other ● There are others out there (covered in pt. 2)

Statements & Logic Gates ● “if” statements and “else if” o if(condition){/* do something */} o else if (condition){/* do something else*/} ● “while” loops o while(condition){/* do something */} ● “for” loops ● switch cases ● et al.

Statements & Logic Gates (contd.) ● || → two vertical bars means “or” ● && → two ampersands means “and” ● == → two equal signs converts int to boolean o ( x = 2 ) = true ● ! → any exclamation point means “not” ● >= or <= → greater/less than or equal to ● += or -= → add to the left side by the right side o x += 20 (add 20 to x) ● ++ or -- → add one to the left side

Math Time! ● You will be using conditionals and paying attention to variables a lot! ● Learning how to read the code is the first step to actually coding. ● The Class below shows some ways of creating variables and checking conditions.

Two Conditions Look at the code below 1.What will z equal (as shown in the code below)? 2.What will z equal if you change the value of x only? 3.What will z equal if you change the value of y only? 4.What will z equal if you change both x and y? Answers: 1.z = 6 2.z = 1 3.z = 0 4.z = 1

Yes, Reading the Code is difficult! ● When you read code you have to constantly refer to other parts of the code ● You must have some kind of method to reading code ● To ease it up for readers, make sure you write your code so that it is readable

Writing code so others can read it. ● Name variables well! ● If it confuses you, it may confuse someone else. ● Casing o Can easily differentiate types of variables o Constants are normally all caps (CONSTANT) o Camel Casing for variables (camelCasingVariable) ● Spacing o Have it so that your code is easy on the eyes

So What does some of our code look like?

Reading The Code ● Even though you don't know what that means, you can read it and sort of understand what it means. ● You know what each variable is based on the name. ● You will learn how structure works in pt 2.

Wrap Up ● In programming, everything is present at the same time ● It looks scary, but with practice you will understand more. ● The best way to program is to first learn what resources you have. ● The API is your friend.