© 2006 Pearson Education 1 Obj: to use assignment operators HW: Prelab Exercises 2 Quiz 3.1 – 3.4 in two class days  Do Now: 1.Read p.144 – 145 (3.4 “more.

Slides:



Advertisements
Similar presentations
Operators and Arithmetic Operations. Operators An operator is a symbol that instructs the code to perform some operations or actions on one or more operands.
Advertisements

Java Planning our Programs Flowcharts Arithmetic Operators.
Flow of Control (1) : Logic Clark Savage Turner, J.D., Ph.D. Some lecture slides have been adapted from those developed.
Aalborg Media Lab 21-Jun-15 Software Design Lecture 2 “ Data and Expressions”
Program Elements We can now examine the core elements of programming (as implemented in Java) We focuse on: data types variable declaration and use, constants.
ECE122 L3: Expression Evaluation February 6, 2007 ECE 122 Engineering Problem Solving with Java Lecture 3 Expression Evaluation and Program Interaction.
Compound Operators 03/07/11. More Operators, First Section 4.4.
6-5: Operations with Radical Expressions I can add or subtract expressions involving radicals.
1 Shortcuts for Lazy Programmers! Topics Increment and Decrement Operators Assignment Operators.
1 Expressions, Operators Expressions Operators and Precedence Reading for this class: L&L, 2.4.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 6: Repetition  Some additional operators increment and decrement.
1 MATERI PENDUKUNG OPERATOR Matakuliah: M0074/PROGRAMMING II Tahun: 2005 Versi: 1/0.
3-5 Solving Equations with the variable on each side Objective: Students will solve equations with the variable on each side and equations with grouping.
Chapter 4: Basic C Operators
Expressions, Data Conversion, and Input
Chapter 3: Program Statements
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-WesleyCopyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
LESSON 6 – Arithmetic Operators
Bell Work 1. 2(x +4) – 5(9n – 9) 3. 3(x – 6) x
Completing the Basic (L06)
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
1.4 Solving Equations ●A variable is a letter which represents an unknown number. Any letter can be used as a variable. ●An algebraic expression contains.
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
Assignment Statements Operator Precedence. ICS111-Java Programming Blanca Polo 2 Assignment, not Equals  An assignment statement changes the value of.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
© 2006 Pearson Education 1 More Operators  To round out our knowledge of Java operators, let's examine a few more  In particular, we will examine the.
Sec. 1-4 Day 2 HW pg (42-46, 53, 62-63, 67, 71-72)
CHAPTER 2 COMPONENTS OF A PROGRAMMING LANGUAGE I NTRODUCTION T O C OMPUTER P ROGRAMMING (CSC425)
Lesson - 7. Operators There are three types of operators: Arithmetic Operators Relational and Equality Operators Logical Operators.
1.3 Solving Linear Equations
Chapter 2 Copyright © 2015, 2011, 2007 Pearson Education, Inc. Chapter Copyright © 2015, 2011, 2007 Pearson Education, Inc. Chapter 2-1 Solving Linear.
Outline Character Strings Variables and Assignment Primitive Data Types Expressions Data Conversion Interactive Programs Graphics Applets Drawing Shapes.
Programming in Java (COP 2250) Lecture 4 Chengyong Yang Fall, 2005.
Subtracting Integers 7 th Grade Math Pg DART statement: I can subtract integers.
1 Program Development  The creation of software involves four basic activities: establishing the requirements creating a design implementing the code.
1 b Boolean expressions b truth tables b conditional operator b switch statement b repetition statements: whilewhile do/whiledo/while forfor Lecture 3.
Operators.
Instructor: Alexander Stoytchev CprE 185: Intro to Problem Solving (using C)
CSCI 1100/1202 January 18, Arithmetic Expressions An expression is a combination of operators and operands Arithmetic expressions compute numeric.
© 2004 Pearson Addison-Wesley. All rights reserved January 23, 2006 Creating Objects & String Class ComS 207: Programming I (in Java) Iowa State University,
Design A software design specifies how a program will accomplish its requirements A design includes one or more algorithms to accomplish its goal.
Data and Expressions. Let's explore some other fundamental programming concepts Chapter 2 focuses on: Character Strings Primitive Data The Declaration.
Principles of Programming - NI July Chapter 4: Basic C Operators In this chapter, you will learn about: Assignment operators Arithmetic operators.
simplify radical expressions involving addition and subtraction.
Addition/ Subtraction
Chapter 2 Assignment and Interactive Input
Arithmetic operations & assignment statement
Data Conversion & Scanner Class
Assignment and Arithmetic expressions
Arithmetic Operator Operation Example + addition x + y
2008/10/27: Lecture 13 CMSC 104, Section 0101 John Y. Park
Increment and Decrement
Lecture 3 Expressions Richard Gesick.
With Assignment Operator
2008/10/27: Lecture 13 CMSC 104, Section 0101 John Y. Park
Assignment Operators Topics Increment and Decrement Operators
Chapter 2: Java Fundamentals
Data Types and Expressions
Operators In Java Programming By Rajanikanth B.
Chap 7. Advanced Control Statements in Java
Assignment Operators Topics Increment and Decrement Operators
Assignment Operators Topics Increment and Decrement Operators
HNDIT11034 More Operators.
Assignment Operators Topics Increment and Decrement Operators
Data Types and Expressions
Assignment Operators Topics Increment and Decrement Operators
3.0 - Design A software design specifies how a program will accomplish its requirements A design includes one or more algorithms to accomplish its goal.
Data Types and Expressions
Presentation transcript:

© 2006 Pearson Education 1 Obj: to use assignment operators HW: Prelab Exercises 2 Quiz 3.1 – 3.4 in two class days  Do Now: 1.Read p.144 – 145 (3.4 “more operators”). 2.Write two different lines of code that will both add 1 to the value of the variable total. 3.Write two different lines of code that will both add 7 to the value of the variable total. C3 D3b

© 2006 Pearson Education 2 Increment and Decrement  The increment and decrement operators are arithmetic and operate on one operand  The increment operator ( ++ ) adds one to its operand  The decrement operator ( -- ) subtracts one from its operand  The statement count++; is functionally equivalent to count = count + 1;

© 2006 Pearson Education 3 Assignment Operators  Often we perform an operation on a variable, and then store the result back into that variable  Java provides assignment operators to simplify that process  For example, the statement num += count; is equivalent to num = num + count;

© 2006 Pearson Education 4 Assignment Operators  There are many assignment operators, including the following: Operator += -= *= /= %= Example x += y x -= y x *= y x /= y x %= y Equivalent To x = x + y x = x - y x = x * y x = x / y x = x % y

© 2006 Pearson Education 5 Assignment Operators  The entire right-hand side of an assignment expression is evaluated first, then the result is combined with the original variable  Therefore result /= (total-MIN) % num; is equivalent to result = result / ((total-MIN) % num);

© 2006 Pearson Education 6 Try this:  p.180 Multiple Choice #3.1  If time: begin “Processing Grades” Lab.