SEARCH

Found 50 related files. Current in page 1

soalan integer matematik tingkatan 2

The Java® Language Specification - Oracle Documentation

The Java® Language. Specification. Java SE 7 Edition. James Gosling. Bill Joy. Guy Steele. Gilad Bracha. Alex Buckley. 2013-02-28 ... Table of Contents Preface to the Java SE 7 Edition xv Preface to the Third Edition xvii Preface to the Second Edition xxi Preface to the First Edition xxiii 1 Introduction 1 1.1 1.2 1.3 1.4 1.5 Organization of the Specification 2 Example Programs 5 Notation 6 Relationship to Predefined Classes and Interfaces 6 References 7 2 Grammars 9 2.1 2.2 2.3 2.4 Context-Free Grammars 9 The Lexical Grammar 9 The Syntactic Grammar 10 Grammar Notation 10 3 Lexical Structure 15 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 Unicode 15 Lexical Translations 16 Unicode Escapes 17 Line Terminators 18 Input Elements and Tokens 19 White Space 21 Comments 21 Identifiers 23 Keywords 24 Literals 25 3.10.1 Integer Literals 25 3.10.2 Floating-Point Literals 32 3.10.3 Boolean Literals 35 3.10.4 Character Literals 35 3.10.5 String Literals 36 3.10.6 Escape Sequences for Character and String Literals 38 iii The Java® Language Specification 3.11 3.12 3.10.7 The Null Literal 39 Separators 40 Operators 40 4 Types, Values, and Variables 41...

Tags: Java 7, Software,
KUNCI JAWABAN UJIAN TENGAH SEMESTER

KUNCI JAWABAN UJIAN TENGAH SEMESTER Kode/Nama Mata Kuliah Waktu/Sifat Ujian : TKC106/Algoritma Pemrograman [Kelas B] : 90 Menit/Open Note [Score = 30] 1. Dua buah bilangan bulat dimasukkan melalui piranti masukan. Buatlah sebuah algoritma (pseudocode) untuk melakukan operasi-operasi berdasarkan kemungkinan-kemungkinan berikut: a. Apabila kedua bilangan adalah bilangan yang berbeda: Bilangan yang lebih kecil dijumlahkan dengan angka 10 dan hasilnya dicetak ke piranti keluaran Bilangan yang lebih besar dijumlahkan dengan angka 5 dan hasilnya dicetak ke piranti keluaran b. Apabila kedua bilangan adalah bilangan yang sama: Kedua bilangan dijumlahkan dan dibagi dengan angka 2, kemudian hasilnya dicetak ke piranti keluaran KETENTUAN: Tidak diperbolehkan menggunakan Operator LOGIKA! Jawaban: Algoritma operasi_PENYELEKSIAN Deklarasi: bil1,bil2: integer Deskripsi: read(bil1,bil2) if bil1 = bil2 then write((bil1 + bil2)/2); else if bil1 < bil2 then write(bil1 + 10) write(bil2 + 5) else write(bil1 + 5) write(bil2 + 10) endif endif [Score = 10] 2. Translasikan algoritma pada soal no (1) ke dalam Bahasa Pascal! Jawaban: program operasi_PENYELEKSIAN; var bil1,bil2: integer; begin bilangan write('Masukkan bilangan pertama! ');readln(bil1); ');readln ln(bil2); write('Masukkan bilangan kedua! ');readln(bil2); if bil1 = bil2 then writeln('Oleh karena kedua bilangan adalah sama, maka hasil penjumlahan kedua bilangan yang kemudian dibagi 2 = ',((bil1 + bil2)/2):3:0) else

Some Calculus Problems - Penn Math
by luan 0 Comments favorite 21 Viewed Download 0 Times

—... A por whi™h re—l x does this improper integr—l ™onvergec ˜A ƒhow th—t G(x + I) = xG(x) —nd dedu™e th—t G(n + I) = n3 for —ny integer n ! HF QIF ƒ—y g(t ) X R 3 R2 de¢nes — smooth ™urve in the pl—neF —A sf g(H) = H —nd kgH (t )k ™ D show th—t for —ny „ ! HD kg(„ )k ™„ F woreoverD show th—t equ—lity ™—n o™™ur if —nd only if one h—s g(t ) = ™vt where v is — unit ve™tor th—t does not depend on t F ˜A sf g(H) = HD gH (H) = H —nd kgHH (t )k IPD give —n upper ˜ound estim—te for kg(P)k F ‡hen ™—n this upper ˜ound ˜e —™hievedc QPF vet r(t ) de¢ne — smooth ™urve th—t does not p—ss through the originF —A sf the point a = r(t0 ) is — point on the ™urve th—t is ™losest to the origin @—nd not —n end point of the ™urveAD show th—t the position ve™tor r(t0 ) is perpendi™ul—r to the t—ngent ve™tor rH (t0 ) F ˜A ‡h—t ™—n you s—y —˜out — point b = r(t1 ) th—t is furthest from the originc QQF gonsider two smooth pl—ne ™urves g1 ; g2 X (H; I) 3 R2 th—t do not interse™tF ƒuppose €1 —nd €2 —re points on g1 —nd g2 D respe™tivelyD su™h th—t the dist—n™e j€1 €2 j is miniE m—lF €rove th—t the str—ight line €1 €2 is norm—l to ˜oth ™urvesF R QRF vet h(x; y; z) = H de¢ne — smooth surf—™e in R3 —nd let € X= (—; ˜; ™) ˜e — point not on the surf—™eF sf  X (x; y; z) is — point on the surf—™e th—t is ™losest to € D show th—t the line € is perpendi™ul—r to the t—ngent pl—ne to the surf—™e —t  F QSF vet r(t ) des™ri˜e — smooth ™urve —nd let V ˜e — ¢xed ve™torF sf rH (t ) is perpendi™ul—r to V for —ll t —nd if r(H) is perpendi™ul—r to V D show th—t r(t ) is perpendi™ul—r to V for —ll t F QTF vet f (s) ˜e —ny differenti—˜le fun™tion of the re—l v—ri—˜le s F ƒhow th—t u(x; t ) X= f (x + Qt ) h—s the property th—t ut = Qux F ƒhow th—t u —lso s—tis¢es the w—ve equ—tion utt = Wuxx F QUF vet u(x; y) ˜e — smooth fun™tionF —A sf ux = H with u(H; y) = sin(Qy) D ¢nd u(x; y) F ˜A sf ux = Pxy with u(H; y) = sin(Qy) D ¢nd u(x; y) F ™A sf ux + uy = H with u(H; y) = sin(Qy) D ¢nd u(x; y) F ss there more th—n one su™h fun™tionc dA sf ux + uy = Q Pxy with u(H; y) = sin(Qy) D ¢nd u(x; y) F ss eA sf ux Puy = H with u(H; y) = sin(Qy) D ¢nd u(x; y) F ss there more th—n one su™h fun™tionc QVF vet r X= xi + yj —nd V(x; y) X= p(x; y)i + q(x; y)j ˜e @smoothA ve™tor ¢elds —nd g — R smooth ™urve in the pl—neF sn this pro˜lem s is the line integr—l s = C V ¡ d r F por e—™h of the followingD either give — proof or give — ™ounterex—mpleF —A sf g is — verti™—l line segment —nd q(x; y) = HD then s = HF ˜A sf g is — ™ir™le —nd q(x; y) = HD then s = HF ™A sf g is — ™ir™le ™entered —t the origin —nd p(x; y) = q(x; y) D then s = HF dA sf p(x; y) > H —nd q(x; y) > HD then s > HF QWF vet g denote the unit ™ir™le ™entered —t the origin of the pl—neD —nd h denote the ™ir™le of r—dius S ™entered —t (P; I) D ˜oth oriented ™ounter™lo™kwiseF vet  denote the ring region ˜etween these R ™urvesF sf — ve™tor ¢eld V s—tis¢es div V = HD show th—t the line R integr—l C V ¡ N ds = D V ¡ N ds = ‘„his extends immedi—tely to the situ—tion where g —nd h —re more gener—l ™urves —nd  is the region ˜etween themF por £uid £ow it is —n expression of ™onserv—tion of m—ssD sin™e div V = H me—ns there —re no sour™es or sinks in the region  F“...

The Introduction of Android Evo Laser Introduction: - Wicked Lasers

Android Evo Laser is a mobile application for controlling Laser device via 3.5mm Audio Jack connected to Smartphone device . The EvoLaser is controlled by PWM(pulse with modulated),meaning the power state of the laser is determined by the duration of active ON period of each cycle. -Power On State of Laser: 18 to 84 % active ON of duty cycle. -Power Off State of Laser: 16% and lower active ON of duty cycle. The workflow of Android Evo Laser app Splash Activity Audio Jack is plugged? yes No Main Activity Error Activity Send the Changes of Tone(mode ,power ,frequency etc). Generate Tone Service The Child Activity of Main Activity Communicate to Laser device with generated Tone Laser Device How does the Android Evo Laser app work? Splash Activity: This is the first activity that runs on launching app. To control Laser device, it is necessary that phone device is connected with laser device via audio bus. So when Audio Jack is plugged in, the control logic goes to Main Activity, otherwise goes to Error Activity. Code: public void gotoMainPage() { if(audioManager.isWiredHeadsetOn()) { Intent intent = new Intent(this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } else{ Intent intent = new Intent(this, ErrorActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); } } Main Activity: If audio jack is plugged in, the control logic goes to Main Activity when app launches. In this activity start GenerateToneService for communicating to Laser device. Code: Intent intent=new Intent(MainActivity.this,GenerateToneService.class); startService(intent); And start child activities (Continuous Activity, Momentary Activity, Strobe Activity etc). The Protocol for Generating Tone (ToneManager): To control laser device, it is needed to make a tone signal. In this protocol we refer the formulas as follows: -Power On State of Laser: 18 to 84 % active ON of duty cycle. -Power Off State of Laser: 16% and lower active ON of duty cycle. -The Member Variable of ToneManager class. mode:The Integer variable which indicates the tone mode. This can be one of 4 modes (Continuous,Momentary,Strobe,Fade). power:The Double variable which controls the strength of the laser. The means of this variable ...

İntibak Komisyonu Raporlama Örnekleri - Mühendislik Fakültesi ...

RAPORLAMA ÖRNEĞİ-1 TALEP: Erciyes Üniversitesi Fen Fakültesi Matematik Bölümünde eğitim gören Mustafa MOLU isimli öğrenci LYS sınavı ile Fakültemiz Elektrik-Elektronik Mühendisliği Bölümünü kazanmış olup, önceki bölümünde almış olduğu bazı derslerden muafiyet talep etmektedir. GEREĞİ: Bu öğrencinin muaf tutulduğu toplam dersi saati 13 olup, sınıf muafiyeti için gerekli olan %70 lik muafiyet koşulunu sağlamadığından dolayı bu öğrenciye “Ders Muafiyeti Raporu” düzenlenir. Talepte bulunan öğrenci Erciyes Üniversitesi öğrencisi olduğu için önceki bölümündeki almış olduğu ve muaf olduğu derslerin notları Fakültemizin sistemine aynen aktarılacaktır. Düzenlenecek raporda notlar belirtildikten sonra karşısına “BAŞARILI” yazılacaktır. Şartlı geçilmiş bir ders ise (DC ve DD) “ŞARTLI GEÇER” olarak yazılacak ve not ortalamasına etki ettirilecektir. Bu öğrenci ve bu tip ders muafiyetleri için örnek rapor aşağıda verilmiştir. NOT: Bölümlerin intibak komisyonu Başkanı, hazırlayacakları rapor için Bölüm Başkanlıklarına aşağıdaki gibi bir üst yazı sunacaktır. Bölümümüz…………………..numaralı öğrencilerinden …………………………………….’ın not durum belgesi ve ders müfredatı komisyonumuzca incelenmiş ve Ders Muafiyet Raporu ekte sunulmuştur. Bilgilerinize arz ederim. TALEP: Süleyman Demirel Üniversitesi Mühendislik Fakültesinde eğitim gören Ömer Fatih ÇITIRIK isimli öğrenci LYS sınavı ile Fakültemiz Tekstil Mühendisliği Bölümünü kazanmış olup, önceki bölümünde almış olduğu bazı derslerden muafiyet talep etmektedir. GEREĞİ: Bu öğrencinin muaf tutulduğu toplam dersi saati 50 olup, 2.sınıf 3. yarıyıla intibakı için gerekli olan ilk iki yarıyılın toplam ders saatlerinin en az %70 inden muaf olma koşulunu sağladığından dolayı bu öğrenciye “Sınıf İntibakı Raporu” düzenlenir. Talepte bulunan öğrenci Üniversitemiz dışından bir öğrenci olduğu için önceki bölümündeki almış olduğu ve muaf olduğu derslerin notları Fakültemizin sistemine etki ettirilmeyecektir. Düzenlenecek raporda notlar belirtildikten sonra karşısına “MUAF” ya da “ALACAK” yazılacaktır. Bu öğrenci ve bu tip sınıf intibakları için örnek rapor aşağıda verilmiştir...

KUNCI JAWABAN UJIAN TENGAH SEMESTER

Dosen Pengampu: Noor Ifada KUNCI JAWABAN UJIAN TENGAH SEMESTER Kode/Nama Mata Kuliah Waktu/Sifat Ujian : TKC106/Algoritma Pemrograman [Kelas B] : 90 Menit/Open Note [Score = 30] 1. Dua buah bilangan bulat dimasukkan melalui piranti masukan. Buatlah sebuah algoritma (pseudocode) untuk melakukan operasi-operasi berdasarkan kemungkinan-kemungkinan berikut: a. Apabila kedua bilangan adalah bilangan yang berbeda: Bilangan yang lebih kecil dijumlahkan dengan angka 10 dan hasilnya dicetak ke piranti keluaran Bilangan yang lebih besar dijumlahkan dengan angka 5 dan hasilnya dicetak ke piranti keluaran b. Apabila kedua bilangan adalah bilangan yang sama: Kedua bilangan dijumlahkan dan dibagi dengan angka 2, kemudian hasilnya dicetak ke piranti keluaran KETENTUAN: Tidak diperbolehkan menggunakan Operator LOGIKA! Jawaban: Algoritma operasi_PENYELEKSIAN Deklarasi: bil1,bil2: integer Deskripsi: read(bil1,bil2) if bil1 = bil2 then write((bil1 + bil2)/2); else if bil1 < bil2 then write(bil1 + 10) write(bil2 + 5) else write(bil1 + 5) write(bil2 + 10) endif endif [Score = 10] 2. Translasikan algoritma pada soal no (1) ke dalam Bahasa Pascal! Jawaban: program operasi_PENYELEKSIAN; var bil1,bil2: integer; begin bilangan write('Masukkan bilangan pertama! ');readln(bil1); ');readln ln(bil2);...

College Algebra and Trigonometry - Cengagebrain.co.uk

Licensed to: iChapters User 7th edition College Algebra and Trigonometry College Algebra and Trigonometry Richard N. Aufmann Vernon C. Barker Richard D. Nation 7th edition Cengage Learning developed and published this special edition for the benefit of students and faculty outside the United States and Canada. Content may significantly differ from the North American college edition. If you purchased this book within the United States or Canada, you should be aware that it has been imported without the approval of the publisher or the author. Aufmann Barker Nation Thank you for choosing a Cengage Learning International Edition. Cengage Learning’s mission is to shape the future of global learning by delivering consistently better learning solutions for students, instructors, and institutions worldwide. This textbook is the result of an innovative and collaborative global development process designed to engage students and deliver content and cases with global relevance. NOT AUTHORIZED FOR SALE IN THE U.S.A. OR CANADA For product information: www.cengage.com/international Visit your local office: www.cengage.com/global Visit our corporate website: www.cengage.com 1439049394_ise_cvr.indd 1 ISE/Aufmann/Barker/Nation, College Algebra and Trigonometry, 7th Edition ISBN-1-4390-4939-4 ©2011 Designer: Denise Davidson Text printer: Quebecor World/Taunton Cover printer: Quebecor World/Taunton Binding: Case Trim: 8.5" x 10" CMYK 1/9/10 5:07 PM 49394_00_FM.qxd 1/9/10 Licensed to: iChapters User 12:09 PM Page iv College Algebra and Trigonometry, Seventh Edition Richard N. Aufmann, Vernon C. Barker, Richard D. Nation Acquisitions Editor: Gary Whalen Developmental Editor: Carolyn Crockett Assistant Editor: Stefanie Beeck © 2011, 2008 Brooks/Cole, Cengage Learning ALL RIGHTS RESERVED. No part of this work covered by the copyright herein may be reproduced, transmitted, stored, or used in any form or by any means graphic, electronic, or mechanical, including but not limited to photocopying, recording, scanning, digitizing, taping, Web distribution, information networks, or information storage and retrieval systems, except as permitted under Section 107 or 108 of the 1976 United States Copyright Act, without the prior written permission of the publisher. Editorial Assistant: Guanglei Zhang Media Editor: Lynh Pham Marketing Manager: Myriah Fitzgibbon Marketing Assistant: Angela Kim Marketing Communications Manager: Katy Malatesta For product information and technology assistance, contact us at Cengage Learning Customer & Sales Support, 1-800-354-9706. For permission to use material from this text or product, submit all requests online at www.cengage.com/permissions. Further permissions questions can be e-mailed to permissionrequest@cengage.com. Content Project Manager: Jennifer Risden Creative Director: Rob Hugel Library of Congress Control Number: 2009938510 Art Director: Vernon Boes International Student Edition: Print Buyer: Karen Hunt ISBN-13: 978-1-4390-4939-6 Rights Acquisitions Account Manager, Text: Roberta Broyer ISBN-10: 1-4390-4939-4 Rights Acquisitions Account Manager, Image: Don Schlotman Production Service: Graphic World Inc. Text Designer: Diane Beasley Brooks/Cole 20 Davis Drive Belmont, CA 94002-3098 USA Photo Researcher: Prepress PMG Copy Editor: Graphic World Inc. Illustrator: Network Graphics; Macmillan Publishing Solutions Cengage Learning is a leading provider of customized learning solutions with office locations around the globe, including Singapore, the United Kingdom, Australia, Mexico, Brazil, and Japan. Locate your local office at www.cengage.com/global. Cover Designer: Lisa Henry Cover Image: Chad Ehlers, Getty Images Compositor: Macmillan Publishing Solutions Cengage Learning products are represented in Canada by Nelson Education, Ltd. To learn more about Brooks/Cole, visit www.cengage.com/brookscole Purchase any of our products at your local college store or at our preferred online store www.CengageBrain.com. Printed in Canada 1 2 3 4 5 6 7 14 13 12 11 10 Copyright 2011 Cengage Learning, Inc. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. 48610_01_ch0p_s01_001-016.qxd Licensed to: iChapters User CHAPTER 10/14/09 5:16 PM P Page 1 PRELIMINARY CONCEPTS AFP/Getty Images P.1 The Real Number System P.2 Integer and Rational Number Exponents P.3 Polynomials P.4 Factoring P.5 Rational Expressions P.6 Complex Numbers Albert Einstein proposed relativity theory more than 100 years ago, in 1905. Martial Trezzini/epa/CORBIS Relativity Is More Than 100 Years Old The Large Hadron Collider (LHC). Atomic particles are accelerated to high speeds inside the long structure in the photo above. By studying particles moving at speeds that approach the speed of light, physicists can confirm some of the tenets of relativity theory. Positron emission tomography (PET) scans, the temperature of Earth’s crust, smoke detectors, neon signs, carbon dating, and the warmth we receive from the sun may seem to be disparate concepts. However, they have a common theme: Albert Einstein’s Theory of Special Relativity. When Einstein was asked about his innate curiosity, he replied: The important thing is not to stop questioning. Curiosity has its own reason for existing. One cannot help but be in awe when he contemplates the mysteries of eternity, of life, of the marvelous structure of reality. It is enough if one tries merely to comprehend a little of this mystery every day. Today, relativity theory is used in conjunction with other concepts of physics to study ideas ranging from the structure of an atom to the structure of the universe. Some of Einstein’s equations require working with radical expressions, such as the expression given in Exercise 139 on page 31; other equations use rational expressions, such as the expression given in Exercise 64 on page 59. 1 Copyright 2011 Cengage Learning, Inc. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. 48610_01_ch0p_s01_001-016.qxd Licensed to: iChapters User 2 CHAPTER P 10/14/09 5:16 PM Page 2 PRELIMINARY CONCEPTS SECTION P.1 Sets Union and Intersection of Sets Interval Notation Absolute Value and Distance Exponential Expressions Order of Operations Agreement Simplifying Variable Expressions The Real Number System Sets Human beings share the desire to organize and classify. Ancient astronomers classified stars into groups called constellations. Modern astronomers continue to classify stars by such characteristics as color, mass, size, temperature, and distance from Earth. In mathematics it is useful to place numbers with similar characteristics into sets. The following sets of numbers are used extensively in the study of algebra. 51, 2, 3, 4, Á 6 Natural numbers 5 Á , -3, -2, -1, 0, 1, 2, 3, Á 6 Integers 5all terminating or repeating decimals6 Rational numbers 5all nonterminating, nonrepeating decimals6 Irrational numbers 5all rational or irrational numbers6 Real numbers If a number in decimal form terminates or repeats a block of digits, then the number is a rational number. Here are two examples of rational numbers. 0.75 is a terminating decimal. 0.245 is a repeating decimal. The bar over the 45 means that the digits 45 repeat without end. That is, 0.245 = 0.24545454 Á . p , where p and q are inteq gers and q Z 0. Examples of rational numbers written in this form are Rational numbers also can be written in the form 3 4 Note that Math Matters Archimedes (c. 287–212 B.C.) was the first to calculate p with any degree of precision. He was able to show that 3 10 1 6 p 6 3 71 7 from which we get the approximation 3 1 22 = L p 7 7 The use of the symbol p for this quantity was introduced by Leonhard Euler (1707–1783) in 1739, approximately 2000 years after Archimedes. 27 110 - 5 2 7 1 -4 3 7 n = 7, and, in general, = n for any integer n. Therefore, all integers are rational 1 1 numbers. p , the decimal form of the rational q number can be found by dividing the numerator by the denominator. When a rational number is written in the form 3 = 0.75 4 27 = 0.245 110 In its decimal form, an irrational number neither terminates nor repeats. For example, 0.272272227 Á is a nonterminating, nonrepeating decimal and thus is an irrational number. One of the best-known irrational numbers is pi, denoted by the Greek symbol p . The number p is defined as the ratio of the circumference of a circle to its diameter. Often in applications the rational number 3.14 or the rational 22 number is used as an approximation of the irrational number p. 7 Every real number is either a rational number or an irrational number. If a real number is written in decimal form, it is a terminating decimal, a repeating decimal, or a nonterminating and nonrepeating decimal. Copyright 2011 Cengage Learning, Inc. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part. 48610_01_ch0p_s01_001-016.qxd Licensed to: iChapters User 10/14/09 5:16 PM Page 3 P.1 The relationships among the various sets of numbers are shown in Figure P.1. Math Matters Sophie Germain (1776–1831) was born in Paris, France. Because enrollment in the university she wanted to attend was available only to men, Germain attended under the name of Antoine-August Le Blanc. Eventually her ruse was discovered, but not before she came to the attention of Pierre Lagrange, one of the best mathematicians of the time. He encouraged her work and became a mentor to her. A certain type of prime number is named after her, called a Germain prime number. It is a number p such that p and 2p + 1 are both prime. For instance, 11 is a Germain prime because 2(11) + 1 = 23 and 11 and 23 are both prime numbers. Germain primes are used in public key cryptography, a method used to send secure communications over the Internet. Alternative to Example 1 For each number, check all that apply. N = Natural I = Integer Q = Rational R = Real N Ϫ57 3.3719 7.42917 0 1.191191119 . . . 101 3 THE REAL NUMBER SYSTEM I Q R Positive integers (natural numbers) 7 1 103 Integers Zero 0 −201 7 0 Rational numbers 3 4 −5 Real numbers 3 4 3.1212 −1.34 −5 3.1212 −1.34 7 Irrational numbers Negative integers −201 −8 1 −5 −0.101101110... √7 π −0.101101110... √7 π −5 0 103 −201 Figure P.1 Prime numbers and composite numbers play an important role in almost every branch of mathematics. A prime number is a positive integer greater than 1 that has no positiveinteger factors1 other than itself and 1. The 10 smallest prime numbers are 2, 3, 5, 7, 11, 13, 17, 19, 23, and 29. Each of these numbers has only itself and 1 as factors. A composite number is a positive integer greater than 1 that is not a prime number. For example, 10 is a composite number because 10 has both 2 and 5 as factors. The 10 smallest composite numbers are 4, 6, 8, 9, 10, 12, 14, 15, 16, and 18. EXAMPLE 1 Classify Real Numbers Determine which of the following numbers are a. integers b. rational numbers c. irrational numbers d. real numbers e. prime numbers f. composite numbers -0.2, 0, 0.3, 0.71771777177771 Á , p, 6, 7, 41, 51 Solution a. Integers: 0, 6, 7, 41, 51 b. Rational numbers: -0.2, 0, 0.3, 6, 7, 41, 51 c. Irrational numbers: 0.71771777177771..., p d. Real numbers: -0.2, 0, 0.3, 0.71771777177771 Á , p, 6, 7, 41, 51 e. Prime numbers: 7, 41 f. Composite numbers: 6, 51 Try Exercise 2, page 14 Each member of a set is called an element of the set. For instance, if C = 52, 3, 56, then the elements of C are 2, 3, and 5. The notation 2 ʦ C is read “2 is an element of C.” 1 A factor of a number divides the number evenly. For instance, 3 and 7 are factors of 21; 5 is not a factor of 21. Copyright 2011 Cengage Learning, Inc. All Rights Reserved. May not be copied, scanned, or duplicated, in whole or in part...

Chapter 7 Arrays - Building Java Programs

CH07 p375-436 1/30/07 1:02 PM Page 375...The sequential nature of files severely limits the number of interesting things you can easily do with them.The algorithms we have examined so far have all been sequential algorithms: algorithms that can be performed by examining each data item once, in sequence.There is an entirely different class of algorithms that can be performed when you can access the data items multiple times and in an arbitrary order. This chapter examines a new object called an array that provides this more flexible kind of access.The concept of arrays is not complex, but it can take a while for a novice to learn all of the different ways that an array can be used. The chapter begins with a general discussion of arrays and then moves into a discussion of common array manipulations as well as advanced array techniques....7.1 Array Basics An array is a flexible structure for storing a sequence of values all of the same type. Array A structure that holds multiple values of the same type. The values stored in an array are called elements. The individual elements are accessed using an integer index. Index An integer indicating the position of a value in a data structure. As an analogy, consider post office boxes. The boxes are indexed with numbers, so you can refer to an individual box by using a description like “PO Box 884.” You already have experience using an index to indicate positions within a String, when calling methods like charAt or substring. As was the case with String indexes, array indexes start with 0. This is a convention known as zero-based indexing. Zero-Based Indexing A numbering scheme used throughout Java in which a sequence of values is indexed starting with 0 (element 0, element 1, element 2, and so on). It might seem more natural to have indexes that start with 1 instead of 0, but Sun decided that Java would use the same indexing scheme that is used in C and C++. Constructing and Traversing an Array Suppose you want to store some different temperature readings. You could keep them in a series of variables: double temperature1; double temperature2; double temperature3; This isn’t a bad solution if you have just 3 temperatures, but suppose you need to store 3000 temperatures. Then you would want something more flexible. You can instead store the temperatures in an array. When using an array, you first need to declare a variable for it, so you have to know what type to use. The type will depend on the type of elements you want to have in your array. To indicate that you want an array, follow the type name with a set of square brackets. For temperatures, you want a sequence of values of type double, so you use the type double[]....This is a very concise way to initialize all the elements of the array. The preceding code works when the array has a length of 100, but you can imagine the array having a different length. Java provides a useful mechanism for making this code more general. Each array keeps track of its own length. You’re using the variable temperature to refer to your array, which means you can ask for temperature.length to find out the length of the array. By using temperature.length in the for loop test instead of the specific value 100, you make your code more general: for (int i = 0; i < temperature.length; i++) { temperature[i] = input.nextDouble(); } Notice that the array convention is different from the String convention. If you have a String variable s, you ask for the length of the String by referring to s.length(). For an array variable, you don’t include the parentheses after the word “length.” This is another one of those unfortunate inconsistencies that Java programmers just have to memorize. The previous code provides a pattern that you will see often with array-processing code: a for loop that starts at 0 and that continues while the loop variable is less than the length of the array, doing something with element [i] in the body of the loop. This goes through each array element sequentially, which we refer to as traversing the array....

Tags: Java 7, Software,
Chapter 7 Arrays - Building Java Programs

CH07 p375-436 1/30/07 1:02 PM Page 375...The sequential nature of files severely limits the number of interesting things you can easily do with them.The algorithms we have examined so far have all been sequential algorithms: algorithms that can be performed by examining each data item once, in sequence.There is an entirely different class of algorithms that can be performed when you can access the data items multiple times and in an arbitrary order. This chapter examines a new object called an array that provides this more flexible kind of access.The concept of arrays is not complex, but it can take a while for a novice to learn all of the different ways that an array can be used. The chapter begins with a general discussion of arrays and then moves into a discussion of common array manipulations as well as advanced array techniques....7.1 Array Basics An array is a flexible structure for storing a sequence of values all of the same type. Array A structure that holds multiple values of the same type. The values stored in an array are called elements. The individual elements are accessed using an integer index. Index An integer indicating the position of a value in a data structure. As an analogy, consider post office boxes. The boxes are indexed with numbers, so you can refer to an individual box by using a description like “PO Box 884.” You already have experience using an index to indicate positions within a String, when calling methods like charAt or substring. As was the case with String indexes, array indexes start with 0. This is a convention known as zero-based indexing. Zero-Based Indexing A numbering scheme used throughout Java in which a sequence of values is indexed starting with 0 (element 0, element 1, element 2, and so on). It might seem more natural to have indexes that start with 1 instead of 0, but Sun decided that Java would use the same indexing scheme that is used in C and C++. Constructing and Traversing an Array Suppose you want to store some different temperature readings. You could keep them in a series of variables: double temperature1; double temperature2; double temperature3; This isn’t a bad solution if you have just 3 temperatures, but suppose you need to store 3000 temperatures. Then you would want something more flexible. You can instead store the temperatures in an array. When using an array, you first need to declare a variable for it, so you have to know what type to use. The type will depend on the type of elements you want to have in your array. To indicate that you want an array, follow the type name with a set of square brackets. For temperatures, you want a sequence of values of type double, so you use the type double[]....This is a very concise way to initialize all the elements of the array. The preceding code works when the array has a length of 100, but you can imagine the array having a different length. Java provides a useful mechanism for making this code more general. Each array keeps track of its own length. You’re using the variable temperature to refer to your array, which means you can ask for temperature.length to find out the length of the array. By using temperature.length in the for loop test instead of the specific value 100, you make your code more general: for (int i = 0; i < temperature.length; i++) { temperature[i] = input.nextDouble(); } Notice that the array convention is different from the String convention. If you have a String variable s, you ask for the length of the String by referring to s.length(). For an array variable, you don’t include the parentheses after the word “length.” This is another one of those unfortunate inconsistencies that Java programmers just have to memorize. The previous code provides a pattern that you will see often with array-processing code: a for loop that starts at 0 and that continues while the loop variable is less than the length of the array, doing something with element [i] in the body of the loop. This goes through each array element sequentially, which we refer to as traversing the array....

Tags: Java 7, Software,
Chapter 7 Arrays - Building Java Programs

CH07 p375-436 1/30/07 1:02 PM Page 375...The sequential nature of files severely limits the number of interesting things you can easily do with them.The algorithms we have examined so far have all been sequential algorithms: algorithms that can be performed by examining each data item once, in sequence.There is an entirely different class of algorithms that can be performed when you can access the data items multiple times and in an arbitrary order. This chapter examines a new object called an array that provides this more flexible kind of access.The concept of arrays is not complex, but it can take a while for a novice to learn all of the different ways that an array can be used. The chapter begins with a general discussion of arrays and then moves into a discussion of common array manipulations as well as advanced array techniques....7.1 Array Basics An array is a flexible structure for storing a sequence of values all of the same type. Array A structure that holds multiple values of the same type. The values stored in an array are called elements. The individual elements are accessed using an integer index. Index An integer indicating the position of a value in a data structure. As an analogy, consider post office boxes. The boxes are indexed with numbers, so you can refer to an individual box by using a description like “PO Box 884.” You already have experience using an index to indicate positions within a String, when calling methods like charAt or substring. As was the case with String indexes, array indexes start with 0. This is a convention known as zero-based indexing. Zero-Based Indexing A numbering scheme used throughout Java in which a sequence of values is indexed starting with 0 (element 0, element 1, element 2, and so on). It might seem more natural to have indexes that start with 1 instead of 0, but Sun decided that Java would use the same indexing scheme that is used in C and C++. Constructing and Traversing an Array Suppose you want to store some different temperature readings. You could keep them in a series of variables: double temperature1; double temperature2; double temperature3; This isn’t a bad solution if you have just 3 temperatures, but suppose you need to store 3000 temperatures. Then you would want something more flexible. You can instead store the temperatures in an array. When using an array, you first need to declare a variable for it, so you have to know what type to use. The type will depend on the type of elements you want to have in your array. To indicate that you want an array, follow the type name with a set of square brackets. For temperatures, you want a sequence of values of type double, so you use the type double[]....This is a very concise way to initialize all the elements of the array. The preceding code works when the array has a length of 100, but you can imagine the array having a different length. Java provides a useful mechanism for making this code more general. Each array keeps track of its own length. You’re using the variable temperature to refer to your array, which means you can ask for temperature.length to find out the length of the array. By using temperature.length in the for loop test instead of the specific value 100, you make your code more general: for (int i = 0; i < temperature.length; i++) { temperature[i] = input.nextDouble(); } Notice that the array convention is different from the String convention. If you have a String variable s, you ask for the length of the String by referring to s.length(). For an array variable, you don’t include the parentheses after the word “length.” This is another one of those unfortunate inconsistencies that Java programmers just have to memorize. The previous code provides a pattern that you will see often with array-processing code: a for loop that starts at 0 and that continues while the loop variable is less than the length of the array, doing something with element [i] in the body of the loop. This goes through each array element sequentially, which we refer to as traversing the array....

Tags: Java 7, Software,

« previous  12345