Lesson 4: Overall Review and Assessment

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

1 CSCE 1030 Computer Science 1 Introduction to Object Oriented Programming.
Parameter passing mechanism: pass-by-reference. The Pass-by-reference mechanism - the agreement Recall: Parameter passing mechanism = agreement between.
Written by: Dr. JJ Shepherd
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.
Chapter 2 Review Questions
Java Programming. Objectives Introduce Software Engineering Concepts Introduction to Object Oriented and Java Programming Provide Context for Software.
Chapter 3 Using Classes and Objects. 2 Creating Objects  A variable holds either a primitive type or a reference to an object  A class name can be used.
COMP 14: Primitive Data and Objects May 24, 2000 Nick Vallidis.
Programming Part 1 Armond R. Smith Zhenying Wu. Overview of this Class ● Transition from FTC -> FRC ● Using Your Resources ● Java Keywords o Data Types.
Intro C++ Programming WINDSOR-ESSEX FIRST ROBOTICS
Java Unit 9: Arrays Declaring and Processing Arrays.
Introducing Java.
Java for Robots How to program an NXT robot with a Java Brain Bert G. Wachsmuth Seton Hall University.
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
Classes Java is an Object-Orented Programming language, and one of the main advantages of OOP is code reuse. Code reuse: write code only once, put it in.
Hello AP Computer Science!. What are some of the things that you have used computers for?
FRC Java for Robotics Introduction Team 1279 ColdFusion January 8, 2011.
Week71 APCS-AB: Java Control Structures October 17, 2005.
College Board A.P. Computer Science A Topics Program Design - Read and understand a problem's description, purpose, and goals; Apply data abstraction.
Instructor: Craig Duckett Assignment 1 Due Lecture 5 by MIDNIGHT – NEXT – NEXT Tuesday, October 13 th I will double dog try to.
Introduction to Java and Object-Oriented Programming AJSS Computer Camp Department of Information Systems and Computer Science Ateneo de Manila University.
CS 114 – Class 02 Topics  Computer programs  Using the compiler Assignments  Read pages for Thursday.  We will go to the lab on Thursday.
5 BASIC CONCEPTS OF ANY PROGRAMMING LANGUAGE Let’s get started …
ECE122 Feb. 22, Any question on Vehicle sample code?
0 Odds and Ends in Haskell: Folding, I/O, and Functors Adapted from material by Miran Lipovaca.
CS100A, Fall 1998 Key Concepts 1 These notes contain short definitions of the basic entities that make up a Java program, along with a description of the.
Session 11 Intro to FRC API.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Written by: Dr. JJ Shepherd
College Board Topics – A.P. Computer Science A Program Design - Read and understand a problem's description, purpose, and goals; Apply data abstraction.
CSH Intro. to Java. The Big Ideas in Computer Science Beyond programming Solving tough problems Creating extensible solutions Teams of “Computational.
Chapter 5 – Part 3 Conditionals and Loops. © 2004 Pearson Addison-Wesley. All rights reserved2/19 Outline The if Statement and Conditions Other Conditional.
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
INTRODUCTION TO JAVA PROGRAMMING FOR THE FIRST ROBOTICS COMPETITION JONATHAN DANIEL HEAD PROGRAMMER FERNBANK LINKS.
Greenfoot.
Objects as a programming concept
User-Written Functions
Object Oriented Programming
Repetition (While-Loop) version]
Introduction to Computer Science / Procedural – 67130
Agenda Warmup AP Exam Review: Litvin A2
IF statements.
FLIPPED CLASSROOM ACTIVITY CONSTRUCTOR – USING EXISTING CONTENT
SELECTION STATEMENTS (1)
Methods The real power of an object-oriented programming language takes place when you start to manipulate objects. A method defines an action that allows.
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA
Repetition Chapter 6 12/06/16 & 12/07/16 1 1
Starting Out with Java: From Control Structures through Objects
Lesson 2: Building Blocks of Programming
Chapter 4 LOOPS © Bobby Hoggard, Department of Computer Science, East Carolina University / These slides may not be used or duplicated without permission.
Fe Maidens Programming
Defining Classes and Methods
4-2 Functions in C In C, the idea of top–down design is done using functions. A C program is made of one or more functions, one and only one of which.
Lesson 5: Review of Assessment and Introduction to Command Based Code
Lesson 1: Fundamentals of Programming
Lesson 6: Command-based (continued)
Chapter 4 Writing Classes.
Java Review Most of these slides are based on
4-2 Functions in C In C, the idea of top–down design is done using functions. A C program is made of one or more functions, one and only one of which.
Week 4 Lecture-2 Chapter 6 (Methods).
Welcome to AP Computer Science A!
IPC144 Introduction to Programming Using C Week 4 – Lesson 1
Inheritance and Polymorphism
IPC144 Introduction to Programming Using C Week 4 – Lesson 2
Midterm Review October 23, 2006 ComS 207: Programming I (in Java)
CS Week 2 Jim Williams, PhD.
References Revisted (Ch 5)
Computer Science Club 1st November 2019.
Day 11 The Last Week!.
Presentation transcript:

Lesson 4: Overall Review and Assessment Fe Maidens Programming 2017-2018 For all of the review slides, quickly address each thing we’ve learned, and ask rookies if they want any clarification for any of the topics

Logic Review Before we code, it’s a good idea to write pseudocode, which is basically outlining the steps we need to follow in order to get to our goal. During our first lesson, we walked through the steps of making a peanut butter and jelly sandwich, which was an example of writing pseudocode. We also learned about booleans, which is a type of variable that can either be true or false. These booleans can be used with conditionals, also known as if/else statements, that execute code if certain requirements are fulfilled.

Sample Pseudocode

Coding Review Code is made of information and processes. In Java, information is stored in variables, which have a type, name, and value. Processes are stored in methods, which have a return type, name, encapsulation (private/public), and parameters. Java is an object-oriented programming language. To make your own kind of object, you can make a class, which is a blueprint for creating that object. To make an instance of a class, we use a constructor. When writing robot code, FRC provides us with an API that gives us prewritten classes, methods, and constructors.

Java Syntax Review All statements end with a semicolon. Variable and object declaration: [type] [name]; int x; String hello; Variable instantiation: [name] = [value]; x = 10; Object instantiation: [name] = new [type]([parameters]); hello = new String(“hello”); Method creation: [encapsulation] [return type] [name] ([parameters]){ [content] } public int sum(int num, int num2) { return num + num2; }

Robot Review We use code to control many different parts on the robot, like Talons, which are speed controllers that control the motors, and Solenoids, which control pistons. We also take input from Joysticks for things like driving. All of the code that we write is loaded onto the roboRIO, which is the brain of the robot and allows our code to actually be executed on the robot. When writing robot code, FRC provides us with an API that gives us prewritten classes, methods, and constructors, that you can find at http://first.wpi.edu/FRC/roborio/release/docs/java/

Writing Pseudocode: Next, you will be writing some code to control different parts of the robot! Once we show you a prompt, you will have about 10 minutes to write pseudocode as a group and do a little research if you want to. You will use this pseudocode to write the actual code for each prompt alone at home. You will have until this Saturday at 11:59 to email your solutions to the three prompts to us at aliz@bxscience.edu and shaot@bxscience.edu. Feel free to use the API and the internet if you want to. Even if you’re not sure about your answer, please send it to us anyway! And if you’re not sure how to code it, you can explain how you would answer the prompt to us as well. Make sure they each individually have the pseudocode from the group work. Stress that the assessment is individual. Also have them write down the gist of each prompt Each prompt will be scored out of 5 points

Writing Code Part 1: Write the import statements for the RobotDrive and Joystick classes. Write a method called drive() that will allow somebody to control the robot in tank drive using a controller. Given: -The RobotDrive has been defined as TankDrive. -The robot will be controlled by a Joystick defined as atkJoy. -The left side of the robot will be controlled by axis 1. -The right side of the robot will be controlled by axis 5. //imports (1 point) import edu.wpi.first.wpilibj.Joystick; import edu.wpi.first.wpilibj.RobotDrive; //creation of method (1 point) public void drive(){ //use of API to get input from axis (1 point) double left = atkJoy.getRawAxis(1); double right = atkJoy.getRawAxis(5); //use of tankDrive (1 point) TankDrive.tankDrive(left, right); } //Overall concept (1 point)

Writing Code Part 2: Write the extend() and retract() method that will make a piston extend and retract respectively. Given: -The class has has already been made. -The piston is controlled by a double solenoid. -The double solenoid is defined as sol. //creation of methods (2 point) public void extend(){ //use of set method (1 point) //use of DoubleSolenoid.Value.kForward (1 point) sol.set(DoubleSolenoid.Value.kForward); } public void retract(){ sol.set(DoubleSolenoid.Value.kReverse); //Overall concept (1 point)

Writing Code Part 3: Write a method called setMotor() that takes a parameter speed that allows you to set a motor’s speed to whatever you want. Then, call this method to set the motor to half speed forward. Given: -The motor is controlled by a Talon called leftMotor. -You don’t need to reference any object when calling the setMotor() method. //creation of method (1 point) and parameter (1 point) public void setMotor(double speed){ //use of set with parameter (1 point) leftMotor.set(speed); } //calling the method (1 point) setMotor(0.5); //overall concept (1 point)

Resources for the Future Since this is the last lesson, we want to let you guys know about other ways to continue to code and to learn about computer science in general. We’re really lucky that Bronx Science offers a lot of computer science classes that you can take, like Computer Science Projects, AP Computer Science, Game Programming, and App Development. We also have after school programs like Bronx Science Hackers, Desktop Robotics, and MakerSpace where you can learn more about robotics and engineering.

Resources for the Future There are also a lot of opportunities outside of school that you can use to learn more about computer science! Organizations like Girls Who Code run summer programs that teach you a variety of topics over 6 weeks. (www.girlswhocode.com) There are also a bunch of websites where you can continue learning Java, like Coding Bat (www.codingbat.com), or learn other languages, like Codecademy (www.codecademy.com) An organization called CodeNow is also having workshops in November and December, and applications close October 26. You can find out more at www.codenow.org/apply Also mention if they don’t make the team this year, don’t let it discourage them from applying again next year