Pemrograman VisualMinggu …7… Page 1 MINGGU Ke Tujuh Pemrograman Visual Pokok Bahasan: Arrays Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan.

Slides:



Advertisements
Similar presentations
Chapter 7: Arrays In this chapter, you will learn about
Advertisements

Arrays.
Pemrograman VisualMinggu …6… Page 1 MINGGU Ke Enam Pemrograman Visual Pokok Bahasan: Module, Class & Methods Tujuan Instruksional Khusus: Mahasiswa dapat.
Pemrograman VisualMinggu …2… Page 1 MINGGU Ke Dua Pemrograman Visual Pokok Bahasan: Console Application Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan.
Pemrograman VisualMinggu …5… Page 1 MINGGU Ke Lima Pemrograman Visual Pokok Bahasan: Control Statement II Tujuan Instruksional Khusus: Mahasiswa dapat.
Pemrograman VisualMinggu …3… Page 1 MINGGU Ke Tiga Pemrograman Visual Pokok Bahasan: Class, Objects, Methods and Instance Variable Tujuan Instruksional.
Pemrograman VisualMinggu …12… Page 1 MINGGU Ke Duabelas Pemrograman Visual Pokok Bahasan: File and Stream Tujuan Instruksional Khusus: Mahasiswa dapat.
Pemrograman VisualMinggu …4… Page 1 MINGGU Ke Empat Pemrograman Visual Pokok Bahasan: Control Statement I Tujuan Instruksional Khusus: Mahasiswa dapat.
Case, Arrays, and Structures. Summary Slide  Case Structure –Select Case - Numeric Value Example 1 –Select Case - String Value Example  Arrays –Declaring.
©2004 Brooks/Cole Chapter 8 Arrays. Figures ©2004 Brooks/Cole CS 119: Intro to JavaFall 2005 Sometimes we have lists of data values that all need to be.
Chapter 6 C Arrays Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc. Arrays are data structures.
Arrays Data Structures - structured data are data organized to show the relationship among the individual elements. It usually requires a collecting mechanism.
C++ for Engineers and Scientists Third Edition
1 JavaScript/Jscript: Arrays. 2 Introduction Arrays –Data structures consisting of related data items (collections of data items) JavaScript arrays are.
Fortran- Subprograms Chapters 6, 7 in your Fortran book.
1 JavaScript: Functions and Arrays October 18, 2005 Slides modified from Internet & World Wide Web: How to Program (3rd) edition. By Deitel, Deitel,
Pemrograman VisualMinggu …12… Page 1 MINGGU Ke Duabelas Pemrograman Visual Pokok Bahasan: Exception Handling Tujuan Instruksional Khusus: Mahasiswa dapat.
Chapter 7: Arrays. In this chapter, you will learn about: One-dimensional arrays Array initialization Declaring and processing two-dimensional arrays.
IE 212: Computational Methods for Industrial Engineering
Visual Basic 2010 How to Program © by Pearson Education, Inc. All Rights Reserved.
C How to Program, 6/e Summary © by Pearson Education, Inc. All Rights Reserved.
Operator Precedence First the contents of all parentheses are evaluated beginning with the innermost set of parenthesis. Second all multiplications, divisions,
 2004 Prentice Hall, Inc. All rights reserved. 1 Chapter 11 - JavaScript: Arrays Outline 11.1 Introduction 11.2 Arrays 11.3 Declaring and Allocating Arrays.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 6 - Arrays Outline 6.1Introduction 6.2Arrays.
The University of Texas – Pan American
Pemrograman VisualMinggu …10… Page 1 MINGGU Ke Sepuluh Pemrograman Visual Pokok Bahasan: ADO.NET II Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan.
 2006 Pearson Education, Inc. All rights reserved Arrays.
 2009 Pearson Education, Inc. All rights reserved Arrays.
Session 7 JavaScript/Jscript: Arrays Matakuliah: M0114/Web Based Programming Tahun: 2005 Versi: 5.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Arrays.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Arrays.
Arrays and 2D Arrays.  A Variable Array stores a set of variables that each have the same name and are all of the same type.  Member/Element – variable.
© 2012 EMC Publishing, LLC Slide 1 Chapter 8 Arrays  Can store many of the same type of data together.  Allows a collection of related values to be stored.
ARRAYS 1 Week 2. Data Structures  Data structure  A particular way of storing and organising data in a computer so that it can be used efficiently 
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2009 Pearson Education, Inc., Upper.
Arrays Module 6. Objectives Nature and purpose of an array Using arrays in Java programs Methods with array parameter Methods that return an array Array.
Java Script: Arrays (Chapter 11 in [2]). 2 Outline Introduction Introduction Arrays Arrays Declaring and Allocating Arrays Declaring and Allocating Arrays.
An Introduction to Programming with C++ Fifth Edition Chapter 11 Arrays.
Week # 2: Arrays.  Data structure  A particular way of storing and organising data in a computer so that it can be used efficiently  Types of data.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley More About Array Processing 8.2 There Are Many Uses of Arrays and Many Programming.
 2007 Pearson Education, Inc. All rights reserved C Arrays.
Chapter 9 Processing Lists with Arrays. Class 9: Arrays Understand the concept of random numbers and how to generate random numbers Describe the similarities.
CHAPTER 9 PART II. MULTIDIMENSIONAL ARRAYS Used to represent tables of values arranged in rows and columns. Table element requires two indexes: row and.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
CSCI 3328 Object Oriented Programming in C# Chapter 7: Arrays 1 Xiang Lian The University of Texas Rio Grande Valley Edinburg, TX 78539
 2008 Pearson Education, Inc. All rights reserved. 1 Arrays and Vectors.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Arrays Chapter 7. MIS Object Oriented Systems Arrays UTD, SOM 2 Objectives Nature and purpose of an array Using arrays in Java programs Methods.
CHAPTER 07 Arrays and Vectors (part II). OBJECTIVES In this part you will learn:  To pass arrays to functions.  Basic searching techniques.
SEQUENTIAL AND OBJECT ORIENTED PROGRAMMING Arrays.
Lecture #15 ARRAYS By Shahid Naseem (Lecturer). 2 ARRAYS DEFINITION An array is a sequence of objects of same data type. The objects in an array are also.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Arrays.
VISUAL C++ PROGRAMMING: CONCEPTS AND PROJECTS Chapter 7A Arrays (Concepts)
7.1 Introduction Arrays Arrays are data structures consisting of data items of the same type “Static” entities They remain the same size once they are.
Arrays Chapter 7.
Chapter 11 - JavaScript: Arrays
IS 350 Arrays.
Visual Basic 2010 How to Program
Java How to Program, Late Objects Version, 10/e
VBScript Session 2 Dani Vainstein.
7 Arrays.
Review of Arrays and Pointers
Object Oriented Programming in java
JavaScript Arrays.
Arrays.
Data Structures (CS212D) Week # 2: Arrays.
Arrays Week 2.
VBScript Session 2 Dani Vainstein.
CIS16 Application Development and Programming using Visual Basic.net
10 JavaScript: Arrays.
Presentation transcript:

Pemrograman VisualMinggu …7… Page 1 MINGGU Ke Tujuh Pemrograman Visual Pokok Bahasan: Arrays Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan dan mengaplikasikan konsep Arrays pada Visual Basic 2008 Referensi: Deitel Deitel, Visual Basic 2008 (2009), How to Program, Prentice Hall. Chapter 8

Pemrograman VisualMinggu …7… Page 2 Agenda Declaring and Allocating Arrays Passing an Array to a Method Sorting Array With Method Sort of Class Array Searching Arrays Rectangular Arrays Jagged Arrays Changing the Size of an Array at Execution Time Passing Arrays : ByVal vs ByRef Review for MID-TERM

Pemrograman VisualMinggu …7… Page 3 Introduction Array adalah kumpulan yang digunakan sebagai penyimpan data sementara, digunakan untuk menyimpan sekumpulan data yang sejenis dalam sebuah variabel dan nilai yang dimasukkan dapat diakses menggunakkan indeks x(1)x(2)x(3)x(4)x(5)x(6) 10, 20, 30, …, 60 adalah nilai yang disimpan dalam struktur array 1, 2, 3 …, 10 adalah indeks dari elemen-elemen array X(1), X(2), … x(6) adalah notasi yang digunakan mengacu elemen array

Pemrograman VisualMinggu …7… Page 4 Declaring & Allocating Array Examples: Dim numbers As Integer() numbers = New Integer() {1,2,3,6} Examples: Dim numbers As Integer()= New Integer(11) {} Give Example Declare & Allocating Array Figure

Pemrograman VisualMinggu …7… Page 5 Passing an Array to a Method To pass an array argument to a method, specify the name of the array without using parentheses. Every array object “knows” its own upper bound (i.e., the value returned by the method GetUpperbound), so when you pass an array object to a method, you do not need to pass the upper bound of the array as a separate argument. For a method to receive an array through a method call, the method’s parameter list must specify that an array will be receive. In Visual basic, arrays always are passed by reference, yet it normally inappropriate to use keyword ByRef in the method definition header. Give Example passing an Array to a Method Figure 8.11

Pemrograman VisualMinggu …7… Page 6 Sorting Array With Method Sort of Class Array Sorting data (i.e., arranging the data in some particular order, such as ascending or descending order) is one of the most popular computing applications. Class Array provides methods for creating, modifying, sorting and searching arrays. Shared method Sort of class Array takes an array as its argument and sorts the elements in the array in ascending order. To sort an array in descending order, first call method Sort of class array to sort the array, then call method Reverse of class Array to reverse the order of the elements in the array. Give Example Sorting Array with Method Sort of Class Array Figure 8.15

Pemrograman VisualMinggu …7… Page 7 Searching Arrays Often it is necessary to determine whether an array contains a value that matches a certain key value. The process of locating a particular element value in an array is called searching. The linear search method works well for small or unsorted arrays. However, it is inefficient for large unsorted arrays. If the array is sorted, the high-speed binary search technique can be used. The Array class provides method BinarySearch, which searches a sorted array for a value using binary search. Give Example Searching Array Figure 8.16 – 8.18

Pemrograman VisualMinggu …7… Page 8 Rectangular Arrays One dimensional arrays contain one row of values. Multidimensional arrays require two or more indices to identify particular elements. There are two types of two dimensional arrays, rectangular and jagged. Rectangular arrays with two indices often represent tables of values consisting of information arranged in rows and columns. Each row is the same size, and each column is the same size. Give Example Rectangular Array Figure 8.20

Pemrograman VisualMinggu …7… Page 9 Jagged Arrays Jagged arrays are maintained as arrays of arrays. Unlike rectangular arrays, rows in jagged arrays can be of different lengths. In a jagged array, the second dimension is actually an index into the one-dimensional array that represents the current row. Arrays of two or more dimensions can be traversed using a nested For…Next statement with a separate For…Next statement for each dimension Give Example Jagged Array Figure 8.24

Pemrograman VisualMinggu …7… Page 10 Changing the Size of an Array at Execution Time The ReDim statement enables you to dynamically change the array size by creating a new array and assigning its reference to the specified variable. The ReDim statement contains keyword ReDim, followed by the name of the array to be resized and the new upper bound in parentheses. The ReDim Statement changes the size of the array and reinitializes the value of the elements to the default value of the type of the array element. To save the original data stored in an array, follow the ReDim keyword with the optional preserve keyword. If the new array is smaller than the original array, the existing elements that are outside the bounds of the new array are discarded. If the new array is larger than the original array, all the existing elements are preserved in the now larger array, and the extra elements are initialized to the default value of the type of the array element. Give Example Changing the size of an Array at Execution Time Figure 8.25

Pemrograman VisualMinggu …7… Page 11 Passing Arrays : ByVal vs ByRef If an argument passed using keyword ByVal is of a reference type, the value being copied is a reference to the original object in memory, any changes you make using that reference will be applied to the original object. Visual basic also allows methods to pass references with keyword byRef When a reference type object like an array is passed with ByRef, the called method gains control over the original reference in the caller, allowing the called method to replace the original reference in the caller with a reference to a different object or nothing. Such behavior can lead to unpredictable effects, which can be disastrous in business-critical and mission-critical applications Visual basic provides operator IS for comparing references to determine whether they are referencing the same object. Give Example Passing Arrays: ByVal vs ByRef Figure 8. 26

Pemrograman VisualMinggu …7… Page 12 Questions & Answers

Pemrograman VisualMinggu …7… Page 13 Thank You