Recitation 4 Comp 401-002.

Slides:



Advertisements
Similar presentations
© 2007 Lawrenceville Press Slide 1 Assignment Statement An assignment statement gives a value to a variable. Assignment can take several forms: x = 5;
Advertisements

Written by: Dr. JJ Shepherd
Data Types in Java Data is the information that a program has to work with. Data is of different types. The type of a piece of data tells Java what can.
Numeric literals and named constants. Numeric literals Numeric literal: Example: A numeric literal is a constant value that appears in a Java program.
Numbers and Arrays. Widening and narrowing Numeric types are arranged in a continuum: double float long int short byte, char You can easily assign a narrower.
Factorial Calculator and Debug Mode Slides: tures/Eclipse.pdf
Expressions, Data Conversion, and Input
Correct Assignment: Back of blue worksheet and Page 204 #1-6 & 8-16 Today’s Plan: -Compare and order decimals -Compare and order fractions 11/29/10 Compare.
Today we will show in various ways why decimal and percent equivalents for common fractions can represent the same value. represent – stand for value -
5.2 Like and Unlike Terms.
Introduction to Java Primitive Types Operators Basic input and output.
Javadoc. Purpose of javadoc javadoc is a program that reads your Java program and produces great-looking documentation in HTML format Without any help,
COMP Primitive and Class Types Yi Hong May 14, 2015.
Recitation 7 Collections. Array List and Linked List Array List and Linked List are implementations of the same interface: List. As a result, they have.
Murach, Chapter 5. Common Control Structures Selection: The IF statement Case: The Select Case statement Iteration: Loops 9/28/20082.
Algebra Section 8 Day 1: Exponent Properties Algebra S8 Day 1 1.
Reading & Science ACT Strategies We don’t have the time to take away from our daily instruction to focus directly on the ACT in some of these areas Extra.
BUS 660 Week 1 Assignment Developing Leaders at UPS Developing Leaders at UPS Read and answer the questions to the UPS case study. Submit your answers.
BUS 660 Week 2 Assignment Leadership Style To purchase this material link Assignment-Leadership-Style.
BUS 660 Week 5 Assignment Big Changes for a Small Hospital Big Changes for a Small Hospital Read and answer the questions to the Hospital case study. Submit.
BUS 660 Week 6 Assignment Research Paper To purchase this material link 660/BUS-660-Week-6-Assignment-Research- Paper.
CJA 314 Week 3 Learning Team Criminology in the Future Paper and Presentation (Preparation) To purchase this material link
ACC 421 Week 2 Individual Assignment P1, P2, P3, P4 To purchase this material link Week-2-Individual-Assignment.
Variables and input/output
Polymorphism in Methods
Java Language Basics.
To find near doubles.
Chapter 4 Assignment Statement
Parallelogram - quadrilateral with two pairs of parallel sides
Bell Ringer Represent to following in a compound inequality:
MALT©2006 Maths/Fractions Slide Show : Lesson 1
Recitation #3 Comp Semion Piskarev.
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
Introduction to C Topics Compilation Using the gcc Compiler
Type Systems Terms to learn about types: Related concepts: Type
Computational Thinking
מפגש 2 חשיבה תוצאתית שמעיה דוד
Computational Thinking
Recitation 6 Inheritance.
Learning to Program in Python
IPC144 Introduction to Programming Using C Week 2 – Lesson 1
Learning to Program in Python
Copy the worksheets and have your teacher check your answers.
Dividing by Decimals.
Percents, Fractions, and Decimals
Warm Up: Thursday September 3
Increment and Decrement
Lesson 7-2 Dividing Monomials
Object Oriented Programming (OOP) LAB # 5
Designing Experiments
Composite Objects with Object Editor With slides from Andrew Ghobrial
Arithmetic Expressions & Data Conversions
Dividing by Decimals.
1-8 Multiplying and Dividing Integers
Variables, Types, Operations on Numbers
Please take out your planner. Homework: pg. 74 #11-37 ODD/ pg
Recitation 12 November 18, 2011.
Task: Have a look at these websites:
SSEA Computer Science: Track A
Multiplying and Dividing Integers
Recitation 5 In this recitation you will have an example on displaying multiple objects on ObjectEditor. The code can be found in the recitation page.
LO: TBAT calculate a percentage of an amount using a calculator
Sliding Decimal Points
2-6 Decimals to Fractions and vice versa
Inference Assignment Each of the following slides has a picture and a set of questions which follow. On a piece of paper of your own, answer the questions.
Dividing Fractions.
Warm-up Simplify as far as possible, do not make a decimal. Your answer will still have a square root sign in it. 1. (5 + 4x) + (7 - 2x)    
More concurrency issues
Arithmetic Expressions & Data Conversions
Divide two Integers.
Presentation transcript:

Recitation 4 Comp 401-002

Casting Tells Java, “right now, treat x as a double” Casting reinterprets a variable as a different type. For example, remember that a double is a decimal, and an integer is not. When you divide an integer by an integer, you get an integer. However, we can tell Java to treat one of the integers as a double, in which case the entire result will be a double Tells Java, “right now, treat x as a double”

Interfaces example

Casting objects

In Assignment 3 Every token class will implement at least one interface (the generic token interface) Some token classes will implement additional interfaces You will always use variables through interface variables, not class variables.

Recitation assignment Use the recitation link on the course website to find today’s assignment. Look at the instructions and experiment with the ObjectEditor. On Sakai, submit a screenshot that shows the results of some of your experimentation (we should see that you got the program to run and changed a few things). Some of the instructions are outdated. In particular, on the last slide: Point 1: line numbers are 8 and 9 Point 2: line number is 13 Point 3: Try different values as the argument to the sleep() method, and modify only the numeric argument of moveShapes. Point 4: No need to try to refactor to AStringShape, but try doing it to Rectangle. The point is trying to show that if you do not tag a class as a particular shape, ObjectEditor will try to infer it from the name. Miscellaneous: As in the praxes, try uncommenting different lines to see what is happening