Part I. The Picture class

Save this PDF as:
 WORD  PNG  TXT  JPG

Size: px
Start display at page:

Download "Part I. The Picture class"

Transcription

1 CS 161 LAB 5 This lab will have two parts. In the first part, we will create a class to automate the drawing of the robot from the second lab. For the second part, we will begin a ClunkyCalculator class that will mimic a simple calculator using BlueJ s ability to manually call methods. We will do half of the Calculator class this week and finish it as part of next week s lab. To begin, make a Lab5 folder in your CS161 folder. The two projects you make will go in this folder. Part I As part of the second lab, you were to save the final settings for the robot picture. Find those settings as we will have the computer draw the robot for us. From your Lab2 folder, copy the shapes2 project and paste it into your Lab5 folder. Now open this project in BlueJ. The Picture class Once BlueJ has open this project, select the new class option. Call this class Picture, and when the editor opens with the skeleton class, put your name and the date in the appropriate locations and change the documentation at the beginning of the class to state that it will automatically draw the robot picture from the second lab. The class instance variables Since this class will draw the robot picture, it needs a class instance variable for each of the components. This means the class must have two objects of type Square, three objects of type Rect, two objects of type Triangle, and two objects of type Circle. Rather that naming the objects square1, square2, etc, as BlueJ does, name each object for its role in the picture: Name one of the Square objects head and the other body; name the Rect objects neck, leftarm, and rightarm; name the Triangle objects leftleg and rightleg; and the Circle objects leftwheel and rightwheel. The Constructor The constructor for this class is not very complex. It needs to initialize the nine objects using the new operator. So, for example, one line in the constructor is the following: head = new Square(); Remember that the types of these objects have already been declared at the beginning of the class. DO NOT put the type before the object name; i.e. do NOT write: Square head = new Square(); If you do, you will make the object head a local variable. This means that the class instance variable head would be undefined outside of the constructor. CS 161 Page 1 of 8 Lab 5

2 CS 161 Page 2 of 8 Lab 5

3 The Method drawhead We will make a separate method to draw each of the parts of the robot. While this means there will be nine methods, plus a tenth method that will put it all together, each method will be rather short, simple, and will perform only one action. The drawhead method is public, void, and takes no parameters. Be sure to add the appropriate documentation to the beginning of this method that explains what action the method performs. The first action it takes is to make head visible. If you have forgotten the names of the methods in the Square class, you might want to open the editor for the Square class and switch to the Documentation view. For example, a portion of the Documentation view of the Square class looks like the following: This not only tells you the names of the methods in each class, but what information, if any, you must give to a method to have it perform its actions. Also remember that each method call is an external method call. It must be prefixed with an object name using the dot notation. So, to make head visible, the statement is: head.makevisible(); After head is made visible, it must be resized. Call the appropriate method, passing in the size that you saved from Lab2. CS 161 Page 3 of 8 Lab 5

4 Next, head must be moved to the proper X-Y location. To move the objects to their proper location, use the methods slowmovehorizontal and slowmovevertical. To use these methods, however, you will need to do some calculations. The various methods to move an object in the Square class add their parameter to either the current X-coordinate or the current Y- coordinate. What you most likely saved from Lab2 was the final X and Y-coordinates. To get the proper value to pass to the move methods, you must use the editor to look at the code for the Square class to find the initial X and Y positions and subtract these numbers from the final X and Y positions. It is the difference between the starting and ending coordinates that represents the distance each object must move, and it is this distance that must be passed to move methods. Of course, if you really wanted to, there is no reason why you could not add accessor methods for the X and Y coordinates to the various classes in this project. Then, using the accessor methods, you could get the initial positions and use subtraction statements with your final positions, saving the results in local variables. These variables could be used as actual parameters in the methods that move the objects. This is just a thought, and it is certainly not required for this lab. To review, the steps the drawhead method as well as the other drawing methods must take are the following. 1. Make the object visible. 2. Resize the object to the size you saved from Lab2. 3. Move the object horizontally and vertically to the coordinates that you saved from Lab2. Once you have completed the drawhead method, compile the Picture class, make an object of the class and call the drawhead method. Does it work correctly? If not, fix it before going on to another method. The Other draw Methods There are eight other draw methods to create, one for each part of the robot s body. Call these methods drawbody, drawneck, drawrightarm, and so on. Each of these methods follows the same pattern as the drawhead method. After you finish each method, test the method and correct any errors in the method before you start the next method. In addition, add the appropriate documentation at the beginning of each method. The makepicture method The last method to add is a makepicture method. This method just contains nine statements. Each statement is an internal method call to one of the draw methods, for example: drawhead(); Thus, calling the makepicture method will cause the robot to be drawn. CS 161 Page 4 of 8 Lab 5

5 When the makepicture method works correctly and draws the robot picture, make a printout of the class. Be sure that each method has the appropriate documentation. Then demonstrate the makepicture method for your lab instructor. Part II: The ClunkyCalculator Now for the second project. The purpose of this project is to make some methods that use the basic mathematical and relational operators, practice using local variables, and gain more experience with the conditional if-else statement. One design of computer CPU s is known as an accumulator machine (or a one-address machine). This type of CPU has a special register called the accumulator. Any arithmetic operation, such as adding two values, uses the contents of the accumulator as one of the operands and the result of the operation is stored back in the accumulator. If you are interested, the CPU that was in the original Apple II computer the MOS Technology 6502 processor was an accumulator machine. This is the type of calculator we are going to create in this project. Using BlueJ, create a new project in your Lab5 folder, and call the project clunky-calculator. Then create a new class, which will be called Calculator. This class will have a single field (class instance variable), which is an int and is called accumulator. The Constructor This class has one constructor. The constructor takes no parameters, and it simply assigns accumulator an initial value of zero. The Method clear This is a mutator method that has two statements in its body. The first statement assigns the accumulator a zero and then the second statement is similar to: System.out.println( Accumulator = + accumulator ); The Method loadaccumulator This is another mutator method, but one that takes a parameter. Its actions are to assign the accumulator the value of its parameter, and then it prints the contents of the accumulator to the terminal window using a similar statement to that in the previous method. The Arithmetic Methods Next, we will create five methods to perform the arithmetic operations of add ( + ), subtract ( - ), multiply ( * ), divide ( / ), and mod ( % ). These methods will be quite similar, so you CS 161 Page 5 of 8 Lab 5

6 might find it easier to write the first method, then use copy and paste for the other methods because there will only be slight changes. The Method add This method is a void method, and it takes a single parameter. In the body of the method, a local variable is declared and this variable is assigned the value of accumulator. The reason for this local variable is that the value of accumulator will be changed, but we want to record its value before the change so that it can be printed out. After the contents of accumulator is saved in the local variable, add accumulator with the parameter and assign the result back to accumulator. Then a statement is printed to the terminal window that shows the original value of the accumulator (saved in the local variable), a plus sign, the value of the parameter, an equal sign, and the new value of the accumulator. Thus, if the accumulator originally contained the value 3 and the add method was called with a parameter of 5, the statement that appears in the terminal window should be: = 8 The other 4 methods are similar to the add method. The difference, of course, is the operation each method performs, and the operator that appears in the statement printed to the terminal window. For example, I started with an accumulator containing 0. Then I called add with a parameter of 20, subtract with a parameter of 5, multiply with a parameter of 3, divide with a parameter of 9, and mod with a parameter of 2. Note that I am naming each method with the name of the operation it is performing. My terminal window then contained the following. Notice that in the display the starting value of the accumulator is always the leftmost digit, the parameter to the method is the next digit, and the resulting value of the accumulator is the rightmost digit. The Method compute Now we will add one more method. This method is called compute. It is a void method and takes no parameters. Its purpose is to allow us to test our calculator by placing a sequence of method calls inside this method, compile our class, create an object of the class, and call the compute method. The Final Test CS 161 Page 6 of 8 Lab 5

7 When all your methods are working correctly, place the following sequence of method calls in your compute method. loadaccumulator( 15 ); add( 20 ); subtract( 30 ); multiply( 8 ); divide( 4 ); mod( 4 ); subtract( 5 ); clear(); Now, compile your class, create an object of the class, and call the compute method. If you get the following terminal window: Show this to your lab instructor, give her a printout of your class, and you are done for this week. Next week we will add more methods to this class. The methods that we will add will implement the relational operators. Note, as an aid, I have attached a partial copy of my documentation for this class. CS 161 Page 7 of 8 Lab 5

8 Note: This lab was originally written by Dr. Broeg. CS 161 Page 8 of 8 Lab 5

1 Description of The Simpletron

1 Description of The Simpletron Simulating The Simpletron Computer 50 points 1 Description of The Simpletron In this assignment you will write a program to simulate a fictional computer that we will call the Simpletron. As its name implies

More information

Understanding class definitions

Understanding class definitions OFWJ_C02.QXD 2/3/06 2:28 pm Page 17 CHAPTER 2 Understanding class definitions Main concepts discussed in this chapter: fields methods (accessor, mutator) constructors assignment and conditional statement

More information

Section 1.5 Arithmetic in Other Bases

Section 1.5 Arithmetic in Other Bases Section Arithmetic in Other Bases Arithmetic in Other Bases The operations of addition, subtraction, multiplication and division are defined for counting numbers independent of the system of numeration

More information

Computer Science 281 Binary and Hexadecimal Review

Computer Science 281 Binary and Hexadecimal Review Computer Science 281 Binary and Hexadecimal Review 1 The Binary Number System Computers store everything, both instructions and data, by using many, many transistors, each of which can be in one of two

More information

A Short Introduction to Binary Numbers

A Short Introduction to Binary Numbers A Short Introduction to Binary Numbers Brian J. Shelburne Department of Mathematics and Computer Science Wittenberg University 0. Introduction The development of the computer was driven by the need to

More information

UNIT 2 : NUMBER SYSTEMS

UNIT 2 : NUMBER SYSTEMS UNIT 2 : NUMBER SYSTEMS page 2.0 Introduction 1 2.1 Decimal Numbers 2 2.2 The Binary System 3 2.3 The Hexadecimal System 5 2.4 Number Base Conversion 6 2.4.1 Decimal To Binary 6 2.4.2 Decimal to Hex 7

More information

Inequalities (Year 9)

Inequalities (Year 9) Inequalities (Year 9) Contents What is an inequality? Displaying inequalities on a number line Solving inequalities 4 Showing Inequalities on a graph 4 What is an inequality? An inequality is a mathematical

More information

Determine whether the sequence is arithmetic, geometric, or neither. 18, 11, 4,

Determine whether the sequence is arithmetic, geometric, or neither. 18, 11, 4, Over Lesson 10 1 Determine whether the sequence is arithmetic, geometric, or neither. 18, 11, 4, A. arithmetic B. geometric C. neither Over Lesson 10 1 Determine whether the sequence is arithmetic, geometric,

More information

Adding and Subtracting Polynomials

Adding and Subtracting Polynomials 3.3 Adding and Subtracting Polynomials 3.3 OBJECTIVES 1. Add two polynomials 2. Subtract two polynomials NOTE The plus sign between the parentheses indicates the addition. Addition is always a matter of

More information

Instructional Days: 11-14

Instructional Days: 11-14 Instructional Days: 11-14 Topic Description: In this lesson, students learn how computers can be used as a tool for visualizing data, modeling and design, and art in the context of culturally situated

More information

Examples of Tasks from CCSS Edition Course 3, Unit 5

Examples of Tasks from CCSS Edition Course 3, Unit 5 Examples of Tasks from CCSS Edition Course 3, Unit 5 Getting Started The tasks below are selected with the intent of presenting key ideas and skills. Not every answer is complete, so that teachers can

More information

Java CPD (I) Frans Coenen Department of Computer Science

Java CPD (I) Frans Coenen Department of Computer Science Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials

More information

Apache Hadoop A course for undergraduates Eclipse Reference for Labs

Apache Hadoop A course for undergraduates Eclipse Reference for Labs Apache Hadoop A course for undergraduates Eclipse Reference for Labs 1 Table of Contents Using Eclipse for MapReduce Development... 3 Starting Eclipse... 4 Locating Exercise Source Code... 5 Working with

More information

DIGITAL NUMBERING SYSTEM

DIGITAL NUMBERING SYSTEM SUBCOURSE IT0339 EDITION B US ARMY INTELLIGENCE CENTER DIGITAL NUMBERING SYSTEM DIGITAL NUMBERING SYSTEMS Subcourse Number IT0339 EDITION B US ARMY INTELLIGENCE CENTER Fort Huachuca, AZ 85613-6000 2 Credit

More information

Objects and Classes. Chap ter. 1.1 Objects and classes. Main concepts discussed in this chapter: Concept

Objects and Classes. Chap ter. 1.1 Objects and classes. Main concepts discussed in this chapter: Concept Chap ter 1 Objects and Classes Main concepts discussed in this chapter: objects methods classes parameters It s time to jump in and get started with our discussion of object-oriented programming. Learning

More information

Name Period Date MATHLINKS: GRADE 7 STUDENT PACKET 1 FRACTIONS AND DECIMALS

Name Period Date MATHLINKS: GRADE 7 STUDENT PACKET 1 FRACTIONS AND DECIMALS Name Period Date 7- STUDENT PACKET MATHLINKS: GRADE 7 STUDENT PACKET FRACTIONS AND DECIMALS. Terminating Decimals Convert between fractions and terminating decimals. Compute with simple fractions.. Repeating

More information

Table 3.1: Arithmetic operators

Table 3.1: Arithmetic operators 26 Chapter 3 Arithmetic Expressions Java programs can solve mathematical problems. Often programs that appear nonmathematical on the surface perform a large number of mathematical calculations behind the

More information

The Function Game: Can You Guess the Secret?

The Function Game: Can You Guess the Secret? The Function Game: Can You Guess the Secret? Copy the input and output numbers for each secret given by your teacher. Write your guess for what is happening to the input number to create the output number

More information

C Programming Dr. Hasan Demirel

C Programming Dr. Hasan Demirel C How to Program, H. M. Deitel and P. J. Deitel, Prentice Hall, 5 th edition (3 rd edition or above is also OK). Introduction to C Programming Dr. Hasan Demirel Programming Languages There are three types

More information

Here 4 is the least significant digit (LSD) and 2 is the most significant digit (MSD).

Here 4 is the least significant digit (LSD) and 2 is the most significant digit (MSD). Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26

More information

CS-201 Introduction to Programming with Java

CS-201 Introduction to Programming with Java CS-201 Introduction to Programming with Java California State University, Los Angeles Computer Science Department Lecture I: Introduction to Computers, Programs, and Java Basic Computer Architecture: Binary

More information

Pocantico Hills School District Grade 1 Math Curriculum Draft

Pocantico Hills School District Grade 1 Math Curriculum Draft Pocantico Hills School District Grade 1 Math Curriculum Draft Patterns /Number Sense/Statistics Content Strands: Performance Indicators 1.A.1 Determine and discuss patterns in arithmetic (what comes next

More information

(Refer Slide Time: 00:01:23 min)

(Refer Slide Time: 00:01:23 min) Computer Aided Design Prof. Anoop Chalwa Department of Mechanical Engineering Indian Institute of Technology, Delhi Lecture No. # 02 Input Output Devices, Raster Graphics Today we will be talking about

More information

Borland C++ Compiler: Operators

Borland C++ Compiler: Operators Introduction Borland C++ Compiler: Operators An operator is a symbol that specifies which operation to perform in a statement or expression. An operand is one of the inputs of an operator. For example,

More information

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Digital System Design Prof. D Roychoudhry Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture - 04 Digital Logic II May, I before starting the today s lecture

More information

Part 1 Foundations of object orientation

Part 1 Foundations of object orientation OFWJ_C01.QXD 2/3/06 2:14 pm Page 1 Part 1 Foundations of object orientation OFWJ_C01.QXD 2/3/06 2:14 pm Page 2 1 OFWJ_C01.QXD 2/3/06 2:14 pm Page 3 CHAPTER 1 Objects and classes Main concepts discussed

More information

A.4 Polynomial Division; Synthetic Division

A.4 Polynomial Division; Synthetic Division SECTION A.4 Polynomial Division; Synthetic Division 977 A.4 Polynomial Division; Synthetic Division OBJECTIVES 1 Divide Polynomials Using Long Division 2 Divide Polynomials Using Synthetic Division 1 Divide

More information

Section P.9 Notes Page 1 P.9 Linear Inequalities and Absolute Value Inequalities

Section P.9 Notes Page 1 P.9 Linear Inequalities and Absolute Value Inequalities Section P.9 Notes Page P.9 Linear Inequalities and Absolute Value Inequalities Sometimes the answer to certain math problems is not just a single answer. Sometimes a range of answers might be the answer.

More information

Objectives. Materials

Objectives. Materials Activity 5 Exploring Infinite Series Objectives Identify a geometric series Determine convergence and sum of geometric series Identify a series that satisfies the alternating series test Use a graphing

More information

Lesson 1 Order of Operations

Lesson 1 Order of Operations Lesson 1 Order of Operations "Operations" means things like add, subtract, multiply, divide Student A solved the following problem: 17-7 x 2 = 20. Is he correct? Why or why not? Lesson 1 Order of Operations

More information

Section summaries. d = (x 2 x 1 ) 2 + (y 2 y 1 ) 2. 1 + y 2. x1 + x 2

Section summaries. d = (x 2 x 1 ) 2 + (y 2 y 1 ) 2. 1 + y 2. x1 + x 2 Chapter 2 Graphs Section summaries Section 2.1 The Distance and Midpoint Formulas You need to know the distance formula d = (x 2 x 1 ) 2 + (y 2 y 1 ) 2 and the midpoint formula ( x1 + x 2, y ) 1 + y 2

More information

FPGA Lab 1 & 2 Purpose:

FPGA Lab 1 & 2 Purpose: FPGA Lab 1 & 2 Purpose: In this lab we will be getting acquainted with the FPGA software and hardware with some simple design problems. You will learn how to edit and save designs, compile them, and then

More information

Udacity cs101: Building a Search Engine. Extracting a Link

Udacity cs101: Building a Search Engine. Extracting a Link Udacity cs101: Building a Search Engine Unit 1: How to get started: your first program Extracting a Link Introducing the Web Crawler (Video: Web Crawler)... 2 Quiz (Video: First Quiz)...2 Programming (Video:

More information

Integers (pages 294 298)

Integers (pages 294 298) A Integers (pages 294 298) An integer is any number from this set of the whole numbers and their opposites: { 3, 2,, 0,, 2, 3, }. Integers that are greater than zero are positive integers. You can write

More information

Introduction to Design of a Tiny Computer

Introduction to Design of a Tiny Computer Introduction to Design of a Tiny Computer (Background of LAB#4) Objective In this lab, we will build a tiny computer in Verilog. The execution results will be displayed in the HEX[3:0] of your board. Unlike

More information

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

More information

CS 325 Introduction to Computer Graphics

CS 325 Introduction to Computer Graphics CS 325 Introduction to Computer Graphics 01 / 29 / 2014 Instructor: Michael Eckmann Today s Topics Comments/Questions? Bresenham-Line drawing algorithm Midpoint-circle drawing algorithm Ellipse drawing

More information

Graphing - Slope-Intercept Form

Graphing - Slope-Intercept Form 2.3 Graphing - Slope-Intercept Form Objective: Give the equation of a line with a known slope and y-intercept. When graphing a line we found one method we could use is to make a table of values. However,

More information

CHAPTER TWO. 2.1 Unsigned Binary Counting. Numbering Systems

CHAPTER TWO. 2.1 Unsigned Binary Counting. Numbering Systems CHAPTER TWO Numbering Systems Chapter one discussed how computers remember numbers using transistors, tiny devices that act like switches with only two positions, on or off. A single transistor, therefore,

More information

1. True or False? A natural number is the number 0 or any number obtained by adding 1 to a natural number.

1. True or False? A natural number is the number 0 or any number obtained by adding 1 to a natural number. CS Illuminated, 5 th ed. Chapter 2 Review Quiz 1. True or False? A natural number is the number 0 or any number obtained by adding 1 to a natural number. 2. True or False? The category of numbers called

More information

Decimal Numbers: Base 10 Integer Numbers & Arithmetic

Decimal Numbers: Base 10 Integer Numbers & Arithmetic Decimal Numbers: Base 10 Integer Numbers & Arithmetic Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Example: 3271 = (3x10 3 ) + (2x10 2 ) + (7x10 1 )+(1x10 0 ) Ward 1 Ward 2 Numbers: positional notation Number

More information

The Mathematics Driving License for Computer Science- CS10410

The Mathematics Driving License for Computer Science- CS10410 The Mathematics Driving License for Computer Science- CS10410 Approximating Numbers, Number Systems and 2 s Complement by Nitin Naik Approximating Numbers There are two kinds of numbers: Exact Number and

More information

Section 1.1 Linear Equations: Slope and Equations of Lines

Section 1.1 Linear Equations: Slope and Equations of Lines Section. Linear Equations: Slope and Equations of Lines Slope The measure of the steepness of a line is called the slope of the line. It is the amount of change in y, the rise, divided by the amount of

More information

CIS-16 Lab Lessons Guide part V Visual Basic 2013 (.NET) Microsoft Visual Basic 2013 for Windows(Revised 3/04/15)

CIS-16 Lab Lessons Guide part V Visual Basic 2013 (.NET) Microsoft Visual Basic 2013 for Windows(Revised 3/04/15) CIS-16 Lab Lessons Guide part V Visual Basic 2013 (.NET) Microsoft Visual Basic 2013 for Windows(Revised 3/04/15) Important: You must complete this project in the lab, in one sitting (it takes about 1.5

More information

m + n < 0 94 UNCOVERING STUDENT THINKING ABOUT MATHEMATICS IN THE COMMON CORE, GRADES 6 8 Value of the Inequality 4.1

m + n < 0 94 UNCOVERING STUDENT THINKING ABOUT MATHEMATICS IN THE COMMON CORE, GRADES 6 8 Value of the Inequality 4.1 94 UNCOVERING STUDENT THINKING ABOUT MATHEMATICS IN THE COMMON CE, GRADES 6 8 Value of the Inequality 4.1 If m > 0 and n < 0, decide if each inequality is Always True, Sometimes True, Never True, or Can

More information

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays

A First Book of C++ Chapter 2 Data Types, Declarations, and Displays A First Book of C++ Chapter 2 Data Types, Declarations, and Displays Objectives In this chapter, you will learn about: Data Types Arithmetic Operators Variables and Declarations Common Programming Errors

More information

3.1. RATIONAL EXPRESSIONS

3.1. RATIONAL EXPRESSIONS 3.1. RATIONAL EXPRESSIONS RATIONAL NUMBERS In previous courses you have learned how to operate (do addition, subtraction, multiplication, and division) on rational numbers (fractions). Rational numbers

More information

CHAPTER THREE. 3.1 Binary Addition. Binary Math and Signed Representations

CHAPTER THREE. 3.1 Binary Addition. Binary Math and Signed Representations CHAPTER THREE Binary Math and Signed Representations Representing numbers with bits is one thing. Doing something with them is an entirely different matter. This chapter discusses some of the basic mathematical

More information

Fold again, the same way. We now have four equal regions: the shaded part remains the same, of the paper.

Fold again, the same way. We now have four equal regions: the shaded part remains the same, of the paper. PRIMARY CONTENT MODULE V NUMBER SENSE: Rational Numbers T-12 Equivalent Fractions When do two fractions represent the same amount? Or, when do they represent the same point or number on a number line?

More information

Pre Calculus Math 40S: Explained!

Pre Calculus Math 40S: Explained! www.math0s.com 97 Conics Lesson Part I The Double Napped Cone Conic Sections: There are main conic sections: circle, ellipse, parabola, and hyperbola. It is possible to create each of these shapes by passing

More information

Chapter 4 Operators & Arithmetic

Chapter 4 Operators & Arithmetic Chapter 4 Operators & Arithmetic 4-1 Arithmetic in C++ Arithmetic expressions can be made up of constants, variables, operators and parentheses. The arithmetic operators in C++ are as follows + (addition)

More information

Chapter 2 Formulas and Decimals

Chapter 2 Formulas and Decimals Chapter Formulas and Decimals Section A Rounding, Comparing, Adding and Subtracting Decimals Look at the following formulas. The first formula (P = A + B + C) is one we use to calculate perimeter of a

More information

for the Bill Hanlon bill@hanlonmath.com

for the Bill Hanlon bill@hanlonmath.com Strategies for Learning the Math Facts Bill Hanlon bill@hanlonmath.com The more sophisticated mental operations in mathematics of analysis, synthesis, and evaluation are impossible without rapid and accurate

More information

If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C?

If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C? Problem 3 If A is divided by B the result is 2/3. If B is divided by C the result is 4/7. What is the result if A is divided by C? Suggested Questions to ask students about Problem 3 The key to this question

More information

MAT 135 Midterm Review Dugopolski Sections 2.2,2.3,2.5,2.6,3.3,3.5,4.1,4.2,5.7,5.8,6.1,6.2,6.3

MAT 135 Midterm Review Dugopolski Sections 2.2,2.3,2.5,2.6,3.3,3.5,4.1,4.2,5.7,5.8,6.1,6.2,6.3 Directions: Complete each problem and select the correct answer. NOTE: Not all topics on the midterm are represented in this review. For a complete set of review problems, please do the book-based midterm

More information

7 th Grade Pre Algebra A Vocabulary Chronological List

7 th Grade Pre Algebra A Vocabulary Chronological List SUM sum the answer to an addition problem Ex. 4 + 5 = 9 The sum is 9. DIFFERENCE difference the answer to a subtraction problem Ex. 8 2 = 6 The difference is 6. PRODUCT product the answer to a multiplication

More information

Accuplacer Arithmetic Study Guide

Accuplacer Arithmetic Study Guide Accuplacer Arithmetic Study Guide Section One: Terms Numerator: The number on top of a fraction which tells how many parts you have. Denominator: The number on the bottom of a fraction which tells how

More information

1.10 (a) Effects of logic gates AND, OR, NOT on binary signals in a processor

1.10 (a) Effects of logic gates AND, OR, NOT on binary signals in a processor Chapter 1.10 Logic Gates 1.10 (a) Effects of logic gates AND, OR, NOT on binary signals in a processor Microprocessors are the central hardware that runs computers. There are several components that make

More information

Determining When an Expression Is Undefined

Determining When an Expression Is Undefined Determining When an Expression Is Undefined Connections Have you ever... Tried to use a calculator to divide by zero and gotten an error Tried to figure out the square root of a negative number Expressions

More information

Introduction to Java

Introduction to Java Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high

More information

Scheduling. Getting Started. Scheduling 79

Scheduling. Getting Started. Scheduling 79 Scheduling 9 Scheduling An event planner has to juggle many workers completing different tasks, some of which must be completed before others can begin. For example, the banquet tables would need to be

More information

Section R.2. Fractions

Section R.2. Fractions Section R.2 Fractions Learning objectives Fraction properties of 0 and 1 Writing equivalent fractions Writing fractions in simplest form Multiplying and dividing fractions Adding and subtracting fractions

More information

In this Chapter you ll learn:

In this Chapter you ll learn: Now go, write it before them in a table, and note it in a book. Isaiah 30:8 To go beyond is as wrong as to fall short. Confucius Begin at the beginning, and go on till you come to the end: then stop. Lewis

More information

FRACTION REVIEW. 3 and. Any fraction can be changed into an equivalent fraction by multiplying both the numerator and denominator by the same number

FRACTION REVIEW. 3 and. Any fraction can be changed into an equivalent fraction by multiplying both the numerator and denominator by the same number FRACTION REVIEW A. INTRODUCTION. What is a fraction? A fraction consists of a numerator (part) on top of a denominator (total) separated by a horizontal line. For example, the fraction of the circle which

More information

Lab 2 - CMPS 1043, Computer Science I Introduction to File Input/Output (I/O) Projects and Solutions (C++)

Lab 2 - CMPS 1043, Computer Science I Introduction to File Input/Output (I/O) Projects and Solutions (C++) Lab 2 - CMPS 1043, Computer Science I Introduction to File Input/Output (I/O) Projects and Solutions (C++) (Revised from http://msdn.microsoft.com/en-us/library/bb384842.aspx) * Keep this information to

More information

DECIMAL REVIEW. 2. Change to a fraction Notice that =.791 The zero in front of the decimal place is not needed.

DECIMAL REVIEW. 2. Change to a fraction Notice that =.791 The zero in front of the decimal place is not needed. DECIMAL REVIEW A. INTRODUCTION TO THE DECIMAL SYSTEM The Decimal System is another way of expressing a part of a whole number. A decimal is simply a fraction with a denominator of 10, 100, 1 000 or 10

More information

Representation of Data

Representation of Data Representation of Data In contrast with higher-level programming languages, C does not provide strong abstractions for representing data. Indeed, while languages like Racket has a rich notion of data type

More information

MATH 105: Finite Mathematics 1-1: Rectangular Coordinates, Lines

MATH 105: Finite Mathematics 1-1: Rectangular Coordinates, Lines MATH 105: Finite Mathematics 1-1: Rectangular Coordinates, Lines Prof. Jonathan Duncan Walla Walla College Winter Quarter, 2006 Outline 1 Rectangular Coordinate System 2 Graphing Lines 3 The Equation of

More information

CNCTRAIN OVERVIEW CNC Simulation Systems 1995 2008

CNCTRAIN OVERVIEW CNC Simulation Systems 1995 2008 CNCTRAIN OVERVIEW CNC Simulation Systems 1995 2008 p2 Table of Contents Getting Started 4 Select a control system 5 Setting the Best Screen Layout 6 Loading Cnc Files 7 Simulation Modes 9 Running the Simulation

More information

To Evaluate an Algebraic Expression

To Evaluate an Algebraic Expression 1.5 Evaluating Algebraic Expressions 1.5 OBJECTIVES 1. Evaluate algebraic expressions given any signed number value for the variables 2. Use a calculator to evaluate algebraic expressions 3. Find the sum

More information

WA2099 Introduction to Java using RAD 8.0 EVALUATION ONLY. Student Labs. Web Age Solutions Inc.

WA2099 Introduction to Java using RAD 8.0 EVALUATION ONLY. Student Labs. Web Age Solutions Inc. WA2099 Introduction to Java using RAD 8.0 Student Labs Web Age Solutions Inc. 1 Table of Contents Lab 1 - The HelloWorld Class...3 Lab 2 - Refining The HelloWorld Class...20 Lab 3 - The Arithmetic Class...25

More information

Example 7. na20.nada.kth.se 883)./a.out y = y = y = y = #include <iostream.h> #include <math.

Example 7. na20.nada.kth.se 883)./a.out y = y = y = y = #include <iostream.h> #include <math. In the example above two functions are defined. Both increments the value of i by one, but fcn1 uses call-by-value as parameter passing mechanism and fcn2 uses call-by-reference. call-by-value means that

More information

Determine If An Equation Represents a Function

Determine If An Equation Represents a Function Question : What is a linear function? The term linear function consists of two parts: linear and function. To understand what these terms mean together, we must first understand what a function is. The

More information

Chapter 10. Number Systems and Arithmetic Operations

Chapter 10. Number Systems and Arithmetic Operations 232 Chapter 10 Number Systems and Arithmetic Operations 10.1 The Decimal Number System: The Decimal number system is a number system of base or radix equal to 10, which means that there are 10, called

More information

Multiplication of Signed Binary Numbers in Computer Hardware: A Constructivist Approach

Multiplication of Signed Binary Numbers in Computer Hardware: A Constructivist Approach Multiplication of Signed Binary Numbers in Computer Hardware: A Constructivist Approach Christopher Jenkins Trinity University, cjenkin1@trinity.edu Adam Voss Luther College, vossad01@luther.edu October

More information

Java Review (Essentials of Java for Hadoop)

Java Review (Essentials of Java for Hadoop) Java Review (Essentials of Java for Hadoop) Have You Joined Our LinkedIn Group? What is Java? Java JRE - Java is not just a programming language but it is a complete platform for object oriented programming.

More information

Number Systems and. Data Representation

Number Systems and. Data Representation Number Systems and Data Representation 1 Lecture Outline Number Systems Binary, Octal, Hexadecimal Representation of characters using codes Representation of Numbers Integer, Floating Point, Binary Coded

More information

Custom Linetypes (.LIN)

Custom Linetypes (.LIN) Custom Linetypes (.LIN) AutoCAD provides the ability to create custom linetypes or to adjust the linetypes supplied with the system during installation. Linetypes in AutoCAD can be classified into two

More information

Activity 2: Arithmetic

Activity 2: Arithmetic Activity 2: Arithmetic Now that you ve written a few programs, let s take a step back and discuss how to do basic arithmetic. But first, there s something important to know about why you re working in

More information

#820 Computer Programming 1A

#820 Computer Programming 1A Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement Semester 1

More information

Texas Instruments TI-83, TI-83 Plus Graphics Calculator I.1 Systems of Linear Equations

Texas Instruments TI-83, TI-83 Plus Graphics Calculator I.1 Systems of Linear Equations Part I: Texas Instruments TI-83, TI-83 Plus Graphics Calculator I.1 Systems of Linear Equations I.1.1 Basics: Press the ON key to begin using your TI-83 calculator. If you need to adjust the display contrast,

More information

Data Representation. Representing Data

Data Representation. Representing Data Data Representation COMP 1002/1402 Representing Data A computer s basic unit of information is: a bit (Binary digit) An addressable memory cell is a byte (8 bits) Capable of storing one character 10101010

More information

IV. ALGEBRAIC CONCEPTS

IV. ALGEBRAIC CONCEPTS IV. ALGEBRAIC CONCEPTS Algebra is the language of mathematics. Much of the observable world can be characterized as having patterned regularity where a change in one quantity results in changes in other

More information

The slope m of the line passes through the points (x 1,y 1 ) and (x 2,y 2 ) e) (1, 3) and (4, 6) = 1 2. f) (3, 6) and (1, 6) m= 6 6

The slope m of the line passes through the points (x 1,y 1 ) and (x 2,y 2 ) e) (1, 3) and (4, 6) = 1 2. f) (3, 6) and (1, 6) m= 6 6 Lines and Linear Equations Slopes Consider walking on a line from left to right. The slope of a line is a measure of its steepness. A positive slope rises and a negative slope falls. A slope of zero means

More information

Lines and Linear Equations. Slopes

Lines and Linear Equations. Slopes Lines and Linear Equations Slopes Consider walking on a line from left to right. The slope of a line is a measure of its steepness. A positive slope rises and a negative slope falls. A slope of zero means

More information

Paper 1. Mathematics test. Calculator not allowed. First name. Last name. School KEY STAGE TIER

Paper 1. Mathematics test. Calculator not allowed. First name. Last name. School KEY STAGE TIER Ma KEY STAGE 3 TIER 4 6 2005 Mathematics test Paper 1 Calculator not allowed Please read this page, but do not open your booklet until your teacher tells you to start. Write your name and the name of your

More information

1. Math symbols Operation Symbol Example Order

1. Math symbols Operation Symbol Example Order Excel 2 Microsoft Excel 2013 Mercer County Library System Brian M. Hughes, County Executive Excel s Order of Calculation 1. Math symbols Operation Symbol Example Order Parentheses ( ) =(4+2)*8 1st Exponents

More information

Accuplacer Elementary Algebra Study Guide for Screen Readers

Accuplacer Elementary Algebra Study Guide for Screen Readers Accuplacer Elementary Algebra Study Guide for Screen Readers The following sample questions are similar to the format and content of questions on the Accuplacer Elementary Algebra test. Reviewing these

More information

Introduction to Programming (in C++) Data types and visibility. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. Computer Science, UPC

Introduction to Programming (in C++) Data types and visibility. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. Computer Science, UPC Introduction to Programming (in C++) Data types and visibility Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. Computer Science, UPC Outline Data types Type conversion Visibility Introduction to

More information

LESSON 1 Whole Number Place Value Expanded Notation Reading and Writing Whole Numbers Addition

LESSON 1 Whole Number Place Value Expanded Notation Reading and Writing Whole Numbers Addition LESSON 1 Whole Number Place Value Expanded Notation Reading and Writing Whole Numbers Addition 1.A whole number We use the HinduArabic system to write our numbers. This system is a base 1 system and place

More information

Chapter 2. Values, Variables, and Types. 2.1 Java Values in DrJava s Interaction Pane

Chapter 2. Values, Variables, and Types. 2.1 Java Values in DrJava s Interaction Pane 14 Chapter 2 Values, Variables, and Types In this chapter we explore the primitive building blocks that are used to develop Java programs. We experiment with the following concepts within DrJava s interactive

More information

5.1 The Unit Circle. Copyright Cengage Learning. All rights reserved.

5.1 The Unit Circle. Copyright Cengage Learning. All rights reserved. 5.1 The Unit Circle Copyright Cengage Learning. All rights reserved. Objectives The Unit Circle Terminal Points on the Unit Circle The Reference Number 2 The Unit Circle In this section we explore some

More information

1.5. section. Arithmetic Expressions

1.5. section. Arithmetic Expressions 1-5 Exponential Expression and the Order of Operations (1-9) 9 83. 1 5 1 6 1 84. 3 30 5 1 4 1 7 0 85. 3 4 1 15 1 0 86. 1 1 4 4 Use a calculator to perform the indicated operation. Round answers to three

More information

CSC 221: Computer Programming I. Fall 2006

CSC 221: Computer Programming I. Fall 2006 CSC 221: Computer Programming I Fall 2006 Understanding class definitions class structure fields, constructors, methods parameters assignment statements local variables 1 Looking inside classes recall

More information

Aptitude Test as a Selective Aid for Technical Training Centers Instructions for Use

Aptitude Test as a Selective Aid for Technical Training Centers Instructions for Use Aptitude Test as a Selective Aid for Technical Training Centers Instructions for Use Table of Contents Aptitude Test as a Selective Aid for Technical Training Centers Instructions for Use...1 Foreword...1

More information

Addition and Subtraction

Addition and Subtraction 10 17 0 7 7 2 11 17 5 11 10 12 6 14 12 20 7 3 9 19 4 14 5 0 5 7 0 2 1 2 11 7 8 4 4 10 12 3 9 0 10 11 9 1 8 0 10 12 1 3 9 11 7 8 7 18 1 12 11 12 0 10 3 13 1 5 10 4 8 2 9 7 Sheet 1 10 17 0 7 7 14 2 9 Add

More information

Section 1.5 Exponents, Square Roots, and the Order of Operations

Section 1.5 Exponents, Square Roots, and the Order of Operations Section 1.5 Exponents, Square Roots, and the Order of Operations Objectives In this section, you will learn to: To successfully complete this section, you need to understand: Identify perfect squares.

More information

Name: Date: Adding Zero. Addition. Worksheet A

Name: Date: Adding Zero. Addition. Worksheet A A DIVISION OF + + + + + Adding Zero + + + + + + + + + + + + + + + Addition Worksheet A + + + + + Adding Zero + + + + + + + + + + + + + + + Addition Worksheet B + + + + + Adding Zero + + + + + + + + + +

More information

NS5-38 Remainders and NS5-39 Dividing with Remainders

NS5-38 Remainders and NS5-39 Dividing with Remainders :1 PAGE 89-90 NS5-38 Remainders and NS5-39 Dividing with Remainders GOALS Students will divide with remainders using pictures, number lines and skip counting. Draw: 6 3 = 2 7 3 = 2 Remainder 1 8 3 = 2

More information

The Product Property of Square Roots states: For any real numbers a and b, where a 0 and b 0, ab = a b.

The Product Property of Square Roots states: For any real numbers a and b, where a 0 and b 0, ab = a b. Chapter 9. Simplify Radical Expressions Any term under a radical sign is called a radical or a square root expression. The number or expression under the the radical sign is called the radicand. The radicand

More information