Introduction to Computer Programming, Spring Term 2014 Practice Assignment 4 Discussion:

Size: px
Start display at page:

Download "Introduction to Computer Programming, Spring Term 2014 Practice Assignment 4 Discussion:"

Transcription

1 German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Ahmed Gamal Introduction to Computer Programming, Spring Term 2014 Practice Assignment 4 Discussion: Exercise 4-1 Adder Write a program that adds up integers that the user enters. First the programs asks how many numbers will be added up. Then the program prompts the user for each number. Finally, it prints the sum. The output should be something like: How many integers will be added: 5 Enter integer 1: 3 Enter integer 2: 4 Enter integer 3: -4 Enter integer 4: -3 Enter integer 5: 7 The sum is 7 p u b l i c c l a s s Adding System. o u t. p r i n t l n ( "How many i n t e g e r s w i l l be added? " ) ; i n t n = sc. n e x t I n t ( ) ; i n t i, x, sum = 0 ; f o r ( i = 0 ; i <n ; i ++) System. o u t. p r i n t l n ( " E n t e r i n t e g e r " +( i + 1 ) ) ; x = sc. n e x t I n t ( ) sum += x ; System. o u t. p r i n t l n ( " The sum= "+sum ) ; 1

2 Exercise 4-2 Euclidean Algorithm The Euclidean algorithm determines the greatest common divisor (GCD) of two positive numbers by repeatedly replacing the larger number with the result of subtracting the smaller one from it until the two numbers are equal. Write a Java program for Euclidean algorithm where the user has to enter the two numbers and the program should calculate their greatest common divisor. The output should be something like: Please, enter a first number: 45 Please, enter a second number: 22 The GCD of 45 and 22 is 1 p u b l i c c l a s s E u c l i d i a n System. o u t. p r i n t l n ( " P l e a s e, e n t e r a number : " ) ; i n t num1 = sc. n e x t I n t ( ) ; System. o u t. p r i n t l n ( " P l e a s e, e n t e r a second number : " ) ; i n t num2 = sc. n e x t I n t ( ) ; i n t num1saved = num1 ; i n t num2saved = num2 ; while ( num1!= num2 ) i f ( num1 > num2 ) num1 = num2 ; e l s e num2 = num1 ; System. o u t. p r i n t l n ( " The GCD of " + num1saved + " and " + num2saved + " i s " + num1 ) ; Exercise 4-3 Caesar Cipher To be discussed in the tutorials Write a Java program which takes two input variables message of data type String and key of data type int. The program should shift each character in message with a distance of key. For example: if key=3 then a will be replaced by d and b will be replaced by e and so on. Hint: You can use the following method charat(int index): Returns the character at the specified index. The first character of the sequence is at index 0, the next at index 1 and so on. S t r i n g s = " H e l l o " ; char c = s. c h a r A t ( 0 ) ; The value of c is H. The output should be somthing like this: 2

3 Please enter the Message: Hat Please Enter the Key: 3 The encrypted word is: Kdw p u b l i c c l a s s C a e s a r System. o u t. p r i n t l n ( " P l e a s e E n t e r a Word t o be E n c r y p t e d : " ) ; S t r i n g s = sc. n e x t L i n e ( ) ; System. o u t. p r i n t l n ( " P l e a s e E n t e r a Key : " ) ; i n t key = sc. n e x t L i n e ( ) ; char x ; i n t l = s. l e n g t h ( ) ; i n t i = 0 ; i n t a s c i i = 0 ; while ( i < l ) a s c i i = s. c h a r A t ( i ) + key ; i f ( a s c i i > 122) a s c i i = 2 6 ; x = ( char ) a s c i i ; System. o u t. p r i n t ( x ) ; i ++; System. o u t. p r i n t ( " \ n " ) ; Exercise 4-4 String Manipulation To be discussed in the tutorials Write a program that determines the number of consonants, vowels, punctuation characters, and spaces in an input line. Read in the line into a String (in the usual way). Now use the charat() method in a loop to access the characters one by one. Use a switch statement to increment the appropriate variables based on the current character. After processing the line, print out the results. p u b l i c c l a s s Chars i n t c o n s o n a n t = 0, vowel = 0, p u n c t u a t i o n = 0, s p a c e = 0, d i g i t = 0 ; S t r i n g s t r, lowered ; System. o u t. p r i n t ( " E n t e r a s t r i n g : " ) ; 3

4 s t r = sc. n e x t L i n e ( ) ; / / Convert t h e l e t t e r o f t h e S t r i n g s t r t o lower case. lowered = s t r. tolowercase ( ) ; f o r ( i n t i = 0 ; i < lowered. l e n g t h ( ) ; i ++) s w i t c h ( lowered. c h a r A t ( i ) ) c ase : s p a c e ++; break ; c ase a : c ase e : c ase i : c ase o : c ase u : vowel ++; break ; c ase b : c ase c : c ase d : c ase f : c ase g : c ase h : c ase j : c ase k : c ase l : c ase m : c ase n : c ase p : c ase q : c ase r : c ase s : c ase t : c ase v : c ase w : c ase x : c ase y : c ase z : c o n s o n a n t ++; break ; c ase 0 : c ase 1 : c ase 2 : c ase 3 : c ase 4 : c ase 5 : c ase 6 : c ase 7 : c ase 8 : c ase 9 : d i g i t ++; break ; d e f a u l t : p u n c t u a t i o n ++; System. o u t. p r i n t l n ( " Number of c o n s o n a n t s : " + c o n s o n a n t ) ; System. o u t. p r i n t l n ( " Number of vowels : " + vowel ) ; System. o u t. p r i n t l n ( " Number of d i g i t s : " + d i g i t ) ; System. o u t. p r i n t l n ( " Number of p u n c t u a t i o n s : " + p u n c t u a t i o n ) ; System. o u t. p r i n t l n ( " Number of s p a c e s : " + s p a c e ) ; 4

5 Exercise 4-5 Fixed Length Write a program that asks the user to enter two words. The program then prints out both words on one line. The words will be separated by enought dots so that the total line length is 30. We can use it to make an index for a book. The user enters the name of the chapters/sections and the page number and the program generate the index. You can only print one dot at a time. Enter first word: Chapter 5 Enter second word: 153 Chapter p u b l i c c l a s s Word S t r i n g word1, word2, l i n e = " " ; i n t d o t s ; System. o u t. p r i n t ( " E n t e r f i r s t word : " ) ; word1 = sc. n e x t L i n e ( ) ; System. o u t. p r i n t ( " E n t e r second word : " ) ; word2 = sc. n e x t L i n e ( ) ; d o t s = 30 ( word1. l e n g t h ( ) + word2. l e n g t h ( ) ) ; l i n e = l i n e. c o n c a t ( word1 ) ; f o r ( i n t i = 0 ; i < d o t s ; i ++) l i n e = l i n e. c o n c a t ( ". " ) ; l i n e = l i n e. c o n c a t ( word2 ) ; System. o u t. p r i n t l n ( l i n e ) ; Exercise 4-6 Stream of Numbers Write a Java program to read a list of nonnegative integers and outputs the maximum integer, the minimum integer, and the average of all the integers. The end of the input is indicated by the user entering a negative number. Note that the negative number is not used in finding the maximum, minimum, or average. The output should be something like this: Please enter a sequence of positive numbers The maximum number is : 5 The minimum number is: 2 The average is: 3.5 Use in one program a while loop and in another program a do while loop. 5

6 Using While p u b l i c c l a s s NumbersWhile System. o u t. p r i n t l n ( " P l e a s e e n t e r t h e number " ) ; i n t num = sc. n e x t I n t ( ) ; i f ( num<0) System. o u t. p r i n t l n ( "No p o s i t i v e Numbers e n t e r e d " ) ; e l s e i n t small, l a r g e ; s m a l l = num ; l a r g e = num ; double sum = 0 ; double avg ; i n t c o u n t = 0 ; while ( num>=0) i f ( num< s m a l l ) s m a l l = um ; e l s e i f ( num> l a r g e ) l a r g e = num ; sum += num ; c o u n t ++; System. o u t. p r i n t l n ( " P l e a s e e n t e r a n o t h e r number : " ) ; num = sc. n e x t I n t ( ) ; avg = sum / c o u n t ; System. o u t. p r i n t l n ( " The a v e r a g e of t h e numbers i s " + avg ) ; System. o u t. p r i n t l n ( " The s m a l l e s t i n t e g e r you e n t e r e d i s " + s m a l l ) ; System. o u t. p r i n t l n ( " The l a r g e s t i n t e g e r you e n t e r e d i s " + l a r g e ) ; Using Do While c l a s s NumbersDoWhile System. o u t. p r i n t l n ( " P l e a s e E n t e r a s e q u e n c e of p o s i t i v e numbers : " ) ; i n t i ; / / G e t t i n g t h e f i r s t number and a s s i g n i n g i t t o min and max i = sc. n e x t I n t ( ) ; i n t max = i, min = i, sum = 0, c o u n t = 0 ; i f ( i <0) System. o u t. p r i n t l n ( "No p o s i t i v e numbers e n t e r e d " ) ; e l s e do 6

7 i f ( max< i ) max = i ; i f ( min> i ) min = i ; sum += i ; c o u n t ++; i = sc. n e x t I n t ( ) ; while ( i > 0 ) ; double avg = ( double ) sum / c o u n t ; System. o u t. p r i n t l n ( " The maximum number i s " + max ) ; System. o u t. p r i n t l n ( " The minimum number i s " + min ) ; System. o u t. p r i n t l n ( " The a v e r a g e i s " + avg ) ; Exercise 4-7 Triangle N Write a Java program to construct a triangle shape of numbers given that n is an input from the user. For example if n=6, the shape should look like the following: Solve using a single loop only. p u b l i c c l a s s T r i a n g l e System. o u t. p r i n t l n ( " P l e a s e e n t e r t h e number " ) ; i n t n = sc. n e x t I n t ( ) ; i n t i, j ; S t r i n g s = " " ; f o r ( i = 1 ; i <= n ; i ++) s += i ; System. o u t. p r i n t l n ( s ) ; Exercise 4-8 Pyramid To be discussed in the tutorials Construct the following pyramid of numbers given that n is an input from the user. For example if n=9, the pyramid 7

8 should look like the following: p u b l i c c l a s s TriangleNumbers S t r i n g l i n e ; System. o u t. p r i n t l n ( " P l e a s e e n t e r a number between 1 and 9 " ) ; i n t n = sc. n e x t I n t ( ) ; i n t i, m, j, z ; i f ( n / 2 < 5) f o r ( i = 1 ; i <= ( n / 2 ) + 1 ; i ++) f o r ( z = n i +1; z >0; z ) System. o u t. p r i n t ( " " ) ; f o r ( j = 1 ; j <= ( i 2 1); j ++) System. o u t. p r i n t ( j ) ; System. o u t. p r i n t l n ( ) ; e l s e System. o u t. p r i n t l n ( "You e n t e r e d a b i g number r a n g e " ) ; Exercise 4-9 Word Count Write a program that reads a sentence and a word from the user and finds the number of occurrences of the given word in the sentence. For example, the following could be a run of your program Enter the sentence: the students are enjoying life at the GUC Enter the word: the The sentence is "the students are enjoying life at the GUC". The word "the" occurs two times in the sentence p u b l i c c l a s s WordFinder 8

9 System. o u t. p r i n t l n ( " P l e a s e e n t e r t h e s e n t e n c e " ) ; S t r i n g l i n e = sc. n e x t L i n e ( ) ; System. o u t. p r i n t l n ( " P l e a s e e n t e r t h e key word " ) ; S t r i n g word = sc. n e x t L i n e ( ) ; i n t l i n e L e n g t h = l i n e. l e n g t h ( ) ; i n t wordlength = word. l e n g t h ( ) ; i n t wordcounter = 0 ; / / C o n s i d e r t h e. v a l u e v a r i a t i o n. In case t h e u s e r f o r g e t s i t. i f ( l i n e. c h a r A t ( l i n e L e n g t h 1)!=. ) l i n e = l i n e +. ; l i n e L e n g t h ++; i n t i = 0 ; i n t p o i n t e r = 0 ; char c ; S t r i n g tobecompared ; while ( i < l i n e L e n g t h 1) / / Get word by word do c = l i n e. c h a r A t ( p o i n t e r ) ; p o i n t e r ++; while ( ( c!= ) && ( c!= ; ) && ( c!=. ) && ( c!=, ) && ( p o i n t e r < l i n e L e n g t h ) ) ; / / s u b s t r i n g ( x, y ) r e t u r n s t h e word s t a r t i n g from x t o y 1 tobecompared = l i n e. s u b s t r i n g ( i, p o i n t e r 1); / / Now, compare o n l y i f t h e word l e n g t h e q u a l s t h e key word l e n g t h i f ( wordlength == tobecompared. l e n g t h ( ) ) / / Comparing t h e words i g n o r i n g Upper and Lower c a s e s i f ( word. e q u a l s I g n o r e C a s e ( tobecompared ) == true ) wordcounter ++; i = p o i n t e r ; System. o u t. p r i n t l n ( " Number of Occurence : " + wordcounter ) ; Exercise 4-10 Number of Digits Write a Java program that reads from the user positive integers and count the number of digits in them. The program should keep asking the user for entering integers until he/she enters -1. The output should be something like this: Please enter a number 524 Number of digits in 524 = 3 Please enter a number 24 9

10 Number of digits in 24 = 2 Please enter a number Number of digits in = 5 Please enter a number -1 Thank you! p u b l i c c l a s s D i g i t C o u n t e r System. o u t. p r i n t l n ( " P l e a s e e n t e r t h e f i r s t number " ) ; i n t num1 = sc. n e x t I n t ( ) ; i n t count, num2 ; while ( num1!= 1) c o u n t = 1 ; num2 = num1 ; while ( num2 / 1 0!= 0) num2 = num2 / 1 0 ; c o u n t ++; System. o u t. p r i n t l n ( " Number of d i g i t s i n " + num1 + " i s " + c o u n t ) ; System. o u t. p r i n t l n ( " P l e a s e e n t e r t h e n e x t number " ) ; num1 = sc. n e x t I n t ( ) ; Exercise 4-11 Divisors To be discussed in the lab Which integer between 1 and has the largest number of divisors, and how many divisors does it have? Write a program to find the answers and print out the results. It is possible that several integers in this range have the same, maximum number of divisors. Your program has to print out one of them. p u b l i c c l a s s M o s t D i v i s o r s i n t maxdivisors = 1 ; i n t numwithmax = 1 ; f o r ( i n t n = 2 ; n <= 10000; n ++) i n t d i v i s o r C o u n t = 0 ; f o r ( i n t d = 1 ; d <= n ; d ++) i f ( n % d == 0 ) d i v i s o r C o u n t ++; 10

11 i f ( d i v i s o r C o u n t > maxdivisors ) maxdivisors = d i v i s o r C o u n t ; numwithmax = n ; System. o u t. p r i n t l n ( "Among i n t e g e r s between 1 and 10000, " ) ; System. o u t. p r i n t l n ( " The max number of d i v i s o r s i s " + maxdivisors ) ; System. o u t. p r i n t l n ( "A num with " + maxdivisors + " d i v i s " + numwithmax ) ; Exercise 4-12 Extract Numbers To be discussed in the lab Write a Java program that takes a string containing text and nonnegative numbers form the user and prints out the numbers contained in the string in separate lines. Use nested loops. Running example Please enter your string The year has 365 days and the day has 12 hours Output The numbers contained in your string are p u b l i c c l a s s ExtractNumbers System. o u t. p r i n t l n ( " P l e a s e e n t e r your s t r i n g " ) ; S t r i n g s = sc. n e x t I n t ( ) ; i n t i = 0 ; i n t f l a g = 0 ; while ( i < s. l e n g t h ( ) ) / / t h e end o f t h e s t r i n g i s n o t reached and t h e r e i s a number between 0 and while ( i <s. l e n g t h ( ) && s. c harat ( i ) <=57 && s. c h arat ( i ) >=48 ) System. o u t. p r i n t ( s. c harat ( i ) ) ; i ++; f l a g ++; i f ( f l a g > 0) f l a g = 0 ; System. o u t. p r i n t l n ( ) ; i ++; 11

12 Exercise 4-13 Midterm Spring 2013 To be discussed in the tutorial The method Math.random() gives a real number between 0.0 and , and so 6*Math.random() is between 0.0 and The type-cast operator, (int), can be used to convert this to an integer: (int)(6*math.random()). Thus, (int)(6*math.random()) is one of the integers 0, 1, 2, 3, 4, and 5. To get a number between 1 and 6, we can add 1: (int)(6*math.random()) + 1 Using the statement above, we would like to know how many times we have to roll a pair of dice before they come up snake eyes? Note: Snake eyes means that both dice show a value of 1. Write a method that should return the number of rolls that it makes before the pair of dice come up snake eyes. The method should also display the following message, e.g.: It took 100 rolls to get snake eyes. Note: You have to use a do-while loop. i n t die1, d i e 2 ; / / The v a l u e s r o l l e d on t h e two d i c e. i n t c o u n t R o l l s ; / / Used t o c o u n t t h e number o f r o l l s. c o u n t R o l l s = 0 ; do d i e 1 = ( i n t ) ( Math. random ( ) 6 ) + 1 ; / / r o l l t h e d i c e d i e 2 = ( i n t ) ( Math. random ( ) 6 ) + 1 ; c o u n t R o l l s ++; / / and c o u n t t h i s r o l l while ( d i e 1!= 1 d i e 2!= 1 ) ; System. o u t. p r i n t l n ( " I t took " + c o u n t R o l l s + " r o l l s t o g e t snake eyes. " ) ; 12

Introduction to Computer Programming, Spring Term 2014 Practice Assignment 3 Discussion 15.3.2014-20.3.2014

Introduction to Computer Programming, Spring Term 2014 Practice Assignment 3 Discussion 15.3.2014-20.3.2014 German University in Cairo Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Ahmed Gamal Introduction to Computer Programming, Spring Term 2014 Practice Assignment 3 Discussion 15.3.2014-20.3.2014

More information

Iteration CHAPTER 6. Topic Summary

Iteration CHAPTER 6. Topic Summary CHAPTER 6 Iteration TOPIC OUTLINE 6.1 while Loops 6.2 for Loops 6.3 Nested Loops 6.4 Off-by-1 Errors 6.5 Random Numbers and Simulations 6.6 Loop Invariants (AB only) Topic Summary 6.1 while Loops Many

More information

1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier.

1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier. Study Group 1 Variables and Types 1. Define: (a) Variable, (b) Constant, (c) Type, (d) Enumerated Type, (e) Identifier. 2. What does the byte 00100110 represent? 3. What is the purpose of the declarations

More information

Computer Programming I

Computer Programming I Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,

More information

Unit 6. Loop statements

Unit 6. Loop statements Unit 6 Loop statements Summary Repetition of statements The while statement Input loop Loop schemes The for statement The do statement Nested loops Flow control statements 6.1 Statements in Java Till now

More information

Pseudo code Tutorial and Exercises Teacher s Version

Pseudo code Tutorial and Exercises Teacher s Version Pseudo code Tutorial and Exercises Teacher s Version Pseudo-code is an informal way to express the design of a computer program or an algorithm in 1.45. The aim is to get the idea quickly and also easy

More information

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements 9 Control Statements 9.1 Introduction The normal flow of execution in a high level language is sequential, i.e., each statement is executed in the order of its appearance in the program. However, depending

More information

CS 241 Data Organization Coding Standards

CS 241 Data Organization Coding Standards CS 241 Data Organization Coding Standards Brooke Chenoweth University of New Mexico Spring 2016 CS-241 Coding Standards All projects and labs must follow the great and hallowed CS-241 coding standards.

More information

I PUC - Computer Science. Practical s Syllabus. Contents

I PUC - Computer Science. Practical s Syllabus. Contents I PUC - Computer Science Practical s Syllabus Contents Topics 1 Overview Of a Computer 1.1 Introduction 1.2 Functional Components of a computer (Working of each unit) 1.3 Evolution Of Computers 1.4 Generations

More information

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.

Elementary Number Theory and Methods of Proof. CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook. Elementary Number Theory and Methods of Proof CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215 1 Number theory Properties: 2 Properties of integers (whole

More information

CSIS 202: Introduction to Computer Science Spring term 2015-2016 Midterm Exam

CSIS 202: Introduction to Computer Science Spring term 2015-2016 Midterm Exam Page 0 German University in Cairo April 7, 2016 Media Engineering and Technology Prof. Dr. Slim Abdennadher Dr. Hisham Othman CSIS 202: Introduction to Computer Science Spring term 2015-2016 Midterm Exam

More information

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC

Introduction to Programming (in C++) Loops. Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC Introduction to Programming (in C++) Loops Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer Science, UPC Example Assume the following specification: Input: read a number N > 0 Output:

More information

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification:

Example. Introduction to Programming (in C++) Loops. The while statement. Write the numbers 1 N. Assume the following specification: Example Introduction to Programming (in C++) Loops Assume the following specification: Input: read a number N > 0 Output: write the sequence 1 2 3 N (one number per line) Jordi Cortadella, Ricard Gavaldà,

More information

Assessment Management

Assessment Management Facts Using Doubles Objective To provide opportunities for children to explore and practice doubles-plus-1 and doubles-plus-2 facts, as well as review strategies for solving other addition facts. www.everydaymathonline.com

More information

Chapter 2: Elements of Java

Chapter 2: Elements of Java Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction

More information

The Euclidean Algorithm

The Euclidean Algorithm The Euclidean Algorithm A METHOD FOR FINDING THE GREATEST COMMON DIVISOR FOR TWO LARGE NUMBERS To be successful using this method you have got to know how to divide. If this is something that you have

More information

Number Sense and Operations

Number Sense and Operations Number Sense and Operations representing as they: 6.N.1 6.N.2 6.N.3 6.N.4 6.N.5 6.N.6 6.N.7 6.N.8 6.N.9 6.N.10 6.N.11 6.N.12 6.N.13. 6.N.14 6.N.15 Demonstrate an understanding of positive integer exponents

More information

Grade 6 Mathematics Performance Level Descriptors

Grade 6 Mathematics Performance Level Descriptors Limited Grade 6 Mathematics Performance Level Descriptors A student performing at the Limited Level demonstrates a minimal command of Ohio s Learning Standards for Grade 6 Mathematics. A student at this

More information

QUIZ-II QUIZ-II. Chapter 5: Control Structures II (Repetition) Objectives. Objectives (cont d.) 20/11/2015. EEE 117 Computer Programming Fall-2015 1

QUIZ-II QUIZ-II. Chapter 5: Control Structures II (Repetition) Objectives. Objectives (cont d.) 20/11/2015. EEE 117 Computer Programming Fall-2015 1 QUIZ-II Write a program that mimics a calculator. The program should take as input two integers and the operation to be performed. It should then output the numbers, the operator, and the result. (For

More information

Conditionals (with solutions)

Conditionals (with solutions) Conditionals (with solutions) For exercises 1 to 27, indicate the output that will be produced. Assume the following declarations: final int MAX = 25, LIMIT = 100; int num1 = 12, num2 = 25, num3 = 87;

More information

MATHEMATICS Y3 Using and applying mathematics 3810 Solve mathematical puzzles and investigate. Equipment MathSphere www.mathsphere.co.

MATHEMATICS Y3 Using and applying mathematics 3810 Solve mathematical puzzles and investigate. Equipment MathSphere www.mathsphere.co. MATHEMATICS Y3 Using and applying mathematics 3810 Solve mathematical puzzles and investigate. Equipment Paper, pencil, ruler Dice, number cards, buttons/counters, boxes etc MathSphere 3810 Solve mathematical

More information

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language

Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language Translation Translating to Java Introduction to Computer Programming The job of a programmer is to translate a problem description into a computer language. You need to be able to convert a problem description

More information

Intermediate Math Circles March 7, 2012 Linear Diophantine Equations II

Intermediate Math Circles March 7, 2012 Linear Diophantine Equations II Intermediate Math Circles March 7, 2012 Linear Diophantine Equations II Last week: How to find one solution to a linear Diophantine equation This week: How to find all solutions to a linear Diophantine

More information

Chapter 3. if 2 a i then location: = i. Page 40

Chapter 3. if 2 a i then location: = i. Page 40 Chapter 3 1. Describe an algorithm that takes a list of n integers a 1,a 2,,a n and finds the number of integers each greater than five in the list. Ans: procedure greaterthanfive(a 1,,a n : integers)

More information

MATHS ACTIVITIES FOR REGISTRATION TIME

MATHS ACTIVITIES FOR REGISTRATION TIME MATHS ACTIVITIES FOR REGISTRATION TIME At the beginning of the year, pair children as partners. You could match different ability children for support. Target Number Write a target number on the board.

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

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

Mental Maths module for the Foundation Phase

Mental Maths module for the Foundation Phase Mental Maths module for the Foundation Phase 1 CONTENTS 1. The importance of Mental Mathematics p 4 2. Benefits of Mental Maths p 6 3. Mental Maths games p 7 4. Mental Maths activities p 8 2 1. The importance

More information

Algebra 1: Basic Skills Packet Page 1 Name: Integers 1. 54 + 35 2. 18 ( 30) 3. 15 ( 4) 4. 623 432 5. 8 23 6. 882 14

Algebra 1: Basic Skills Packet Page 1 Name: Integers 1. 54 + 35 2. 18 ( 30) 3. 15 ( 4) 4. 623 432 5. 8 23 6. 882 14 Algebra 1: Basic Skills Packet Page 1 Name: Number Sense: Add, Subtract, Multiply or Divide without a Calculator Integers 1. 54 + 35 2. 18 ( 30) 3. 15 ( 4) 4. 623 432 5. 8 23 6. 882 14 Decimals 7. 43.21

More information

Objectives To review making ballpark estimates; and to review the counting-up and trade-first subtraction algorithms. materials. materials.

Objectives To review making ballpark estimates; and to review the counting-up and trade-first subtraction algorithms. materials. materials. Objectives To review making ballpark estimates; and to review the counting-up and trade-first subtraction algorithms. Teaching the Lesson materials Key Activities Children make ballpark estimates for -digit

More information

Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may

Number Theory. Proof. Suppose otherwise. Then there would be a finite number n of primes, which we may Number Theory Divisibility and Primes Definition. If a and b are integers and there is some integer c such that a = b c, then we say that b divides a or is a factor or divisor of a and write b a. Definition

More information

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

More information

3/13/2012. Writing Simple C Programs. ESc101: Decision making using if-else and switch statements. Writing Simple C Programs

3/13/2012. Writing Simple C Programs. ESc101: Decision making using if-else and switch statements. Writing Simple C Programs Writing Simple C Programs ESc101: Decision making using if- and switch statements Instructor: Krithika Venkataramani Semester 2, 2011-2012 Use standard files having predefined instructions stdio.h: has

More information

Passing 1D arrays to functions.

Passing 1D arrays to functions. Passing 1D arrays to functions. In C++ arrays can only be reference parameters. It is not possible to pass an array by value. Therefore, the ampersand (&) is omitted. What is actually passed to the function,

More information

CSC 221: Computer Programming I. Fall 2011

CSC 221: Computer Programming I. Fall 2011 CSC 221: Computer Programming I Fall 2011 Python control statements operator precedence importing modules random, math conditional execution: if, if-else, if-elif-else counter-driven repetition: for conditional

More information

MATH 140 Lab 4: Probability and the Standard Normal Distribution

MATH 140 Lab 4: Probability and the Standard Normal Distribution MATH 140 Lab 4: Probability and the Standard Normal Distribution Problem 1. Flipping a Coin Problem In this problem, we want to simualte the process of flipping a fair coin 1000 times. Note that the outcomes

More information

Lesson/Unit Plan Name: Patterns: Foundations of Functions

Lesson/Unit Plan Name: Patterns: Foundations of Functions Grade Level/Course: 4 th and 5 th Lesson/Unit Plan Name: Patterns: Foundations of Functions Rationale/Lesson Abstract: In 4 th grade the students continue a sequence of numbers based on a rule such as

More information

The While Loop. Objectives. Textbook. WHILE Loops

The While Loop. Objectives. Textbook. WHILE Loops Objectives The While Loop 1E3 Topic 6 To recognise when a WHILE loop is needed. To be able to predict what a given WHILE loop will do. To be able to write a correct WHILE loop. To be able to use a WHILE

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 5 Lecture 5-2: Random Numbers reading: 5.1-5.2 self-check: #8-17 exercises: #3-6, 10, 12 videos: Ch. 5 #1-2 1 The Random class A Random object generates pseudo-random* numbers.

More information

Sue Fine Linn Maskell

Sue Fine Linn Maskell FUN + GAMES = MATHS Sue Fine Linn Maskell Teachers are often concerned that there isn t enough time to play games in maths classes. But actually there is time to play games and we need to make sure that

More information

Ready, Set, Go! Math Games for Serious Minds

Ready, Set, Go! Math Games for Serious Minds Math Games with Cards and Dice presented at NAGC November, 2013 Ready, Set, Go! Math Games for Serious Minds Rande McCreight Lincoln Public Schools Lincoln, Nebraska Math Games with Cards Close to 20 -

More information

Opposites are all around us. If you move forward two spaces in a board game

Opposites are all around us. If you move forward two spaces in a board game Two-Color Counters Adding Integers, Part II Learning Goals In this lesson, you will: Key Term additive inverses Model the addition of integers using two-color counters. Develop a rule for adding integers.

More information

Common Core Unit Summary Grades 6 to 8

Common Core Unit Summary Grades 6 to 8 Common Core Unit Summary Grades 6 to 8 Grade 8: Unit 1: Congruence and Similarity- 8G1-8G5 rotations reflections and translations,( RRT=congruence) understand congruence of 2 d figures after RRT Dilations

More information

Big Data Analytics. Lucas Rego Drumond

Big Data Analytics. Lucas Rego Drumond Big Data Analytics Big Data Analytics Lucas Rego Drumond Information Systems and Machine Learning Lab (ISMLL) Institute of Computer Science University of Hildesheim, Germany Apache Spark Apache Spark 1

More information

Objective. Materials. TI-73 Calculator

Objective. Materials. TI-73 Calculator 0. Objective To explore subtraction of integers using a number line. Activity 2 To develop strategies for subtracting integers. Materials TI-73 Calculator Integer Subtraction What s the Difference? Teacher

More information

Unit 4: Exploring Math Patterns...106. Introduction...5. Unit 1: Visualizing Math...17. Unit 5: Exploring Probability...125

Unit 4: Exploring Math Patterns...106. Introduction...5. Unit 1: Visualizing Math...17. Unit 5: Exploring Probability...125 Introduction....................................5 WHAT IS MICROWORLDS EX, AND HOW CAN IT HELP ME IN THE MATH CLASSROOM?.................6 HOW TO USE THIS BOOK AND CD.....................10 CLASSROOM ENVIRONMENT..........................12

More information

Practice Questions. CS161 Computer Security, Fall 2008

Practice Questions. CS161 Computer Security, Fall 2008 Practice Questions CS161 Computer Security, Fall 2008 Name Email address Score % / 100 % Please do not forget to fill up your name, email in the box in the midterm exam you can skip this here. These practice

More information

Example of a Java program

Example of a Java program Example of a Java program class SomeNumbers static int square (int x) return x*x; public static void main (String[] args) int n=20; if (args.length > 0) // change default n = Integer.parseInt(args[0]);

More information

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void 1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

More information

System.out.println("\nEnter Product Number 1-5 (0 to stop and view summary) :

System.out.println(\nEnter Product Number 1-5 (0 to stop and view summary) : Benjamin Michael Java Homework 3 10/31/2012 1) Sales.java Code // Sales.java // Program calculates sales, based on an input of product // number and quantity sold import java.util.scanner; public class

More information

You are to simulate the process by making a record of the balls chosen, in the sequence in which they are chosen. Typical output for a run would be:

You are to simulate the process by making a record of the balls chosen, in the sequence in which they are chosen. Typical output for a run would be: Lecture 7 Picking Balls From an Urn The problem: An urn has n (n = 10) balls numbered from 0 to 9 A ball is selected at random, its' is number noted, it is set aside, and another ball is selected from

More information

Java Basics: Data Types, Variables, and Loops

Java Basics: Data Types, Variables, and Loops Java Basics: Data Types, Variables, and Loops If debugging is the process of removing software bugs, then programming must be the process of putting them in. - Edsger Dijkstra Plan for the Day Variables

More information

Accentuate the Negative: Homework Examples from ACE

Accentuate the Negative: Homework Examples from ACE Accentuate the Negative: Homework Examples from ACE Investigation 1: Extending the Number System, ACE #6, 7, 12-15, 47, 49-52 Investigation 2: Adding and Subtracting Rational Numbers, ACE 18-22, 38(a),

More information

G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P.

G563 Quantitative Paleontology. SQL databases. An introduction. Department of Geological Sciences Indiana University. (c) 2012, P. SQL databases An introduction AMP: Apache, mysql, PHP This installations installs the Apache webserver, the PHP scripting language, and the mysql database on your computer: Apache: runs in the background

More information

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals

CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals 1 Recall From Last Time: Java Program import java.util.scanner; public class EggBasket { public static void main(string[]

More information

J a v a Quiz (Unit 3, Test 0 Practice)

J a v a Quiz (Unit 3, Test 0 Practice) Computer Science S-111a: Intensive Introduction to Computer Science Using Java Handout #11 Your Name Teaching Fellow J a v a Quiz (Unit 3, Test 0 Practice) Multiple-choice questions are worth 2 points

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

VHDL Test Bench Tutorial

VHDL Test Bench Tutorial University of Pennsylvania Department of Electrical and Systems Engineering ESE171 - Digital Design Laboratory VHDL Test Bench Tutorial Purpose The goal of this tutorial is to demonstrate how to automate

More information

MATH 13150: Freshman Seminar Unit 10

MATH 13150: Freshman Seminar Unit 10 MATH 13150: Freshman Seminar Unit 10 1. Relatively prime numbers and Euler s function In this chapter, we are going to discuss when two numbers are relatively prime, and learn how to count the numbers

More information

Autumn 1 Maths Overview. Year groups Week 1 Week 2 Week 3 Week 4 Week 5 Week 6 Week 7 1 Number and place value. Counting. 2 Sequences and place value.

Autumn 1 Maths Overview. Year groups Week 1 Week 2 Week 3 Week 4 Week 5 Week 6 Week 7 1 Number and place value. Counting. 2 Sequences and place value. Autumn 1 Maths Overview. Year groups Week 1 Week 2 Week 3 Week 4 Week 5 Week 6 Week 7 1 Number and place Counting. 2 Sequences and place Number facts and counting. Money and time. Length, position and

More information

Computers. An Introduction to Programming with Python. Programming Languages. Programs and Programming. CCHSG Visit June 2014. Dr.-Ing.

Computers. An Introduction to Programming with Python. Programming Languages. Programs and Programming. CCHSG Visit June 2014. Dr.-Ing. Computers An Introduction to Programming with Python CCHSG Visit June 2014 Dr.-Ing. Norbert Völker Many computing devices are embedded Can you think of computers/ computing devices you may have in your

More information

An Incomplete C++ Primer. University of Wyoming MA 5310

An Incomplete C++ Primer. University of Wyoming MA 5310 An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages

More information

Building Java Programs

Building Java Programs Building Java Programs Chapter 3 Lecture 3-3: Interactive Programs w/ Scanner reading: 3.3-3.4 self-check: #16-19 exercises: #11 videos: Ch. 3 #4 Interactive programs We have written programs that print

More information

College of the Holy Cross CCSCNE 06 Programming Contest Problems

College of the Holy Cross CCSCNE 06 Programming Contest Problems General Information College of the Holy Cross CCSCNE 06 Programming Contest Problems Your contest account contains sample data files named problemi.dat and problemi.out, i = 1,..., 6, which contain sample

More information

LESSON 4 Missing Numbers in Multiplication Missing Numbers in Division LESSON 5 Order of Operations, Part 1 LESSON 6 Fractional Parts LESSON 7 Lines,

LESSON 4 Missing Numbers in Multiplication Missing Numbers in Division LESSON 5 Order of Operations, Part 1 LESSON 6 Fractional Parts LESSON 7 Lines, Saxon Math 7/6 Class Description: Saxon mathematics is based on the principle of developing math skills incrementally and reviewing past skills daily. It also incorporates regular and cumulative assessments.

More information

A LEVEL H446 COMPUTER SCIENCE. Code Challenges (1 20) August 2015

A LEVEL H446 COMPUTER SCIENCE. Code Challenges (1 20) August 2015 A LEVEL H446 COMPUTER SCIENCE Code Challenges (1 20) August 2015 We will inform centres about any changes to the specification. We will also publish changes on our website. The latest version of our specification

More information

An internal DSL to manipulate collections without loops by Mario Fusco mario@exmachina.ch

An internal DSL to manipulate collections without loops by Mario Fusco mario@exmachina.ch λambdaj An internal DSL to manipulate collections without loops by Mario Fusco mario@exmachina.ch Why is lambdaj born? The best way to understand what lambdaj does and how it works is to start asking why

More information

Sample CSE8A midterm Multiple Choice (circle one)

Sample CSE8A midterm Multiple Choice (circle one) Sample midterm Multiple Choice (circle one) (2 pts) Evaluate the following Boolean expressions and indicate whether short-circuiting happened during evaluation: Assume variables with the following names

More information

Number Representation

Number Representation Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data

More information

CS 378 Big Data Programming. Lecture 24 RDDs

CS 378 Big Data Programming. Lecture 24 RDDs CS 378 Big Data Programming Lecture 24 RDDs Review Assignment 10 Download and run Spark WordCount implementaeon WordCount alternaeve implementaeon Basic RDD TransformaEons we ve discussed filter(function)

More information

Baseball Multiplication Objective To practice multiplication facts.

Baseball Multiplication Objective To practice multiplication facts. Baseball Multiplication Objective To practice multiplication facts. www.everydaymathonline.com epresentations etoolkit Algorithms Practice EM Facts Workshop Game Family Letters Assessment Management Common

More information

2 SYSTEM DESCRIPTION TECHNIQUES

2 SYSTEM DESCRIPTION TECHNIQUES 2 SYSTEM DESCRIPTION TECHNIQUES 2.1 INTRODUCTION Graphical representation of any process is always better and more meaningful than its representation in words. Moreover, it is very difficult to arrange

More information

Solving Rational Equations

Solving Rational Equations Lesson M Lesson : Student Outcomes Students solve rational equations, monitoring for the creation of extraneous solutions. Lesson Notes In the preceding lessons, students learned to add, subtract, multiply,

More information

Foundation 2 Games Booklet

Foundation 2 Games Booklet MCS Family Maths Night 27 th August 2014 Foundation 2 Games Booklet Stage Focus: Trusting the Count Place Value How are games used in a classroom context? Strategically selected games have become a fantastic

More information

Introduction to Apache Pig Indexing and Search

Introduction to Apache Pig Indexing and Search Large-scale Information Processing, Summer 2014 Introduction to Apache Pig Indexing and Search Emmanouil Tzouridis Knowledge Mining & Assessment Includes slides from Ulf Brefeld: LSIP 2013 Organizational

More information

The C++ Language. Loops. ! Recall that a loop is another of the four basic programming language structures

The C++ Language. Loops. ! Recall that a loop is another of the four basic programming language structures The C++ Language Loops Loops! Recall that a loop is another of the four basic programming language structures Repeat statements until some condition is false. Condition False True Statement1 2 1 Loops

More information

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals:

Numeral Systems. The number twenty-five can be represented in many ways: Decimal system (base 10): 25 Roman numerals: Numeral Systems Which number is larger? 25 8 We need to distinguish between numbers and the symbols that represent them, called numerals. The number 25 is larger than 8, but the numeral 8 above is larger

More information

Repetition Using the End of File Condition

Repetition Using the End of File Condition Repetition Using the End of File Condition Quick Start Compile step once always g++ -o Scan4 Scan4.cpp mkdir labs cd labs Execute step mkdir 4 Scan4 cd 4 cp /samples/csc/155/labs/4/*. Submit step emacs

More information

An Introduction to Number Theory Prime Numbers and Their Applications.

An Introduction to Number Theory Prime Numbers and Their Applications. East Tennessee State University Digital Commons @ East Tennessee State University Electronic Theses and Dissertations 8-2006 An Introduction to Number Theory Prime Numbers and Their Applications. Crystal

More information

Programming Languages CIS 443

Programming Languages CIS 443 Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception

More information

PROBLEMS (Cap. 4 - Istruzioni macchina)

PROBLEMS (Cap. 4 - Istruzioni macchina) 98 CHAPTER 2 MACHINE INSTRUCTIONS AND PROGRAMS PROBLEMS (Cap. 4 - Istruzioni macchina) 2.1 Represent the decimal values 5, 2, 14, 10, 26, 19, 51, and 43, as signed, 7-bit numbers in the following binary

More information

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms PROG0101 FUNDAMENTALS OF PROGRAMMING Chapter 3 1 Introduction to A sequence of instructions. A procedure or formula for solving a problem. It was created mathematician, Mohammed ibn-musa al-khwarizmi.

More information

Answers to Review Questions Chapter 7

Answers to Review Questions Chapter 7 Answers to Review Questions Chapter 7 1. The size declarator is used in a definition of an array to indicate the number of elements the array will have. A subscript is used to access a specific element

More information

Stacks. Linear data structures

Stacks. Linear data structures Stacks Linear data structures Collection of components that can be arranged as a straight line Data structure grows or shrinks as we add or remove objects ADTs provide an abstract layer for various operations

More information

17 Greatest Common Factors and Least Common Multiples

17 Greatest Common Factors and Least Common Multiples 17 Greatest Common Factors and Least Common Multiples Consider the following concrete problem: An architect is designing an elegant display room for art museum. One wall is to be covered with large square

More information

Lab Experience 17. Programming Language Translation

Lab Experience 17. Programming Language Translation Lab Experience 17 Programming Language Translation Objectives Gain insight into the translation process for converting one virtual machine to another See the process by which an assembler translates assembly

More information

The Center for Teaching, Learning, & Technology

The Center for Teaching, Learning, & Technology The Center for Teaching, Learning, & Technology Instructional Technology Workshops Microsoft Excel 2010 Formulas and Charts Albert Robinson / Delwar Sayeed Faculty and Staff Development Programs Colston

More information

Hill s Cipher: Linear Algebra in Cryptography

Hill s Cipher: Linear Algebra in Cryptography Ryan Doyle Hill s Cipher: Linear Algebra in Cryptography Introduction: Since the beginning of written language, humans have wanted to share information secretly. The information could be orders from a

More information

Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur

Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur Cryptography and Network Security Department of Computer Science and Engineering Indian Institute of Technology Kharagpur Module No. # 01 Lecture No. # 05 Classic Cryptosystems (Refer Slide Time: 00:42)

More information

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science I. Basic Course Information RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE CISY 105 Foundations of Computer Science A. Course Number and Title: CISY-105, Foundations of Computer Science B. New

More information

Measurement with Ratios

Measurement with Ratios Grade 6 Mathematics, Quarter 2, Unit 2.1 Measurement with Ratios Overview Number of instructional days: 15 (1 day = 45 minutes) Content to be learned Use ratio reasoning to solve real-world and mathematical

More information

arrays C Programming Language - Arrays

arrays C Programming Language - Arrays arrays So far, we have been using only scalar variables scalar meaning a variable with a single value But many things require a set of related values coordinates or vectors require 3 (or 2, or 4, or more)

More information

Mathematics. Mathematical Practices

Mathematics. Mathematical Practices Mathematical Practices 1. Make sense of problems and persevere in solving them. 2. Reason abstractly and quantitatively. 3. Construct viable arguments and critique the reasoning of others. 4. Model with

More information

Programming with TI-Nspire

Programming with TI-Nspire 1 By: Brian Olesen BO@haslev-gym.dk Pilot teacher at Haslev Gymnasium and HF Skolegade 31 4690 Haslev Denmark 2 1. Introduction to the Program Editor Functions and Programs are found in the menu of the

More information

Variables, Constants, and Data Types

Variables, Constants, and Data Types Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class: L&L, 2.1-2.3, App C 1 Primitive Data There are eight

More information

Grade 7/8 Math Circles Fall 2012 Factors and Primes

Grade 7/8 Math Circles Fall 2012 Factors and Primes 1 University of Waterloo Faculty of Mathematics Centre for Education in Mathematics and Computing Grade 7/8 Math Circles Fall 2012 Factors and Primes Factors Definition: A factor of a number is a whole

More information

FTP client Selection and Programming

FTP client Selection and Programming COMP 431 INTERNET SERVICES & PROTOCOLS Spring 2016 Programming Homework 3, February 4 Due: Tuesday, February 16, 8:30 AM File Transfer Protocol (FTP), Client and Server Step 3 In this assignment you will

More information

Scanner sc = new Scanner(System.in); // scanner for the keyboard. Scanner sc = new Scanner(System.in); // scanner for the keyboard

Scanner sc = new Scanner(System.in); // scanner for the keyboard. Scanner sc = new Scanner(System.in); // scanner for the keyboard INPUT & OUTPUT I/O Example Using keyboard input for characters import java.util.scanner; class Echo{ public static void main (String[] args) { Scanner sc = new Scanner(System.in); // scanner for the keyboard

More information

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012 Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

More information