A SSIGNMENT 1: S IMPLE A RRAY IN J AVA Create 2 Class Accessories Class: MyArray.java Implement an array in Class MyArray Implement a series method to.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming Lecture 5 Array and Collections.
Advertisements

Lists: An internal look
Linear ADT Done By : Kishan Gopaul.
Introduction to Arrays Chapter What is an array? An array is an ordered collection that stores many elements of the same type within one variable.
CSCI3170 Introduction to Database Systems
One Dimensional Arrays
BUILDING JAVA PROGRAMS CHAPTER 10.1 ARRAY LISTS. 22 OBJECTIVES! Use ArrayList to construct and analyze lists of arbitrary length.
Monday, 11/11/02, Slide #1 CS 106 Intro to Comp. Sci. 1 Monday, 11/11/02  Questions? HW 04 due today at 5.  Today – Lists and an introduction to searching.
Uploading a Turnitin Assignment Faculty of Humanities and Social Sciences.
J AVA AND V ARIABLES. O VERVIEW Declaring a Variable Primitive Types Java Keywords Reference Variables Object Declaration and Assignment Objects and Garbage.
General Computer Science for Engineers CISC 106 Lecture 19 Dr. John Cavazos Computer and Information Sciences 04/06/2009.
Sets and Maps Chapter 9. Chapter 9: Sets and Maps2 Chapter Objectives To understand the Java Map and Set interfaces and how to use them To learn about.
©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.
© The McGraw-Hill Companies, 2006 Chapter 5 Arrays.
Objectives Learn how to implement the sequential search algorithm Explore how to sort an array using the selection sort algorithm Learn how to implement.
 2003 Prentice Hall, Inc. All rights reserved. 1 Arrays –Structures of related data items –Static entity (same size throughout program) A few types –Pointer-based.
CHAPTER 11 Searching. 2 Introduction Searching is the process of finding a target element among a group of items (the search pool), or determining that.
Java Unit 9: Arrays Declaring and Processing Arrays.
Introduction to Internet Engineering Tutorial 7 All about Assignment 2 By Tse Hok
Computer Science Standard Level Mastery Aspects. Mastery Item Claimed JustificationWhere Listed Arrays Used to store the student data Lines P.
COS 260 DAY 16 Tony Gauvin.
Part 2. Searching Arrays Looking for a specific element in an array E.g., whether a certain score (85) is in a list of scores Linear search Binary search.
Building Java Programs Chapter 13 Searching reading: 13.3.
Chapter 16: Searching, Sorting, and the vector Type.
Array Processing Simple Program Design Third Edition A Step-by-Step Approach 7.
chap8 Chapter 8 Arrays (Hanly) chap8 2 Data Structure Simple data types use a simple memory to store a variable. Data Structure: a.
Case Study: Designing A Telephone Directory Program Ellen Walker CPSC 201 Data Structures Hiram College Includes figures from Objects, Abstraction & Data.
More with Methods (parameters, reference vs. value, array processing) Corresponds with Chapters 5 and 6.
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Marcus Frean.
Chapter 11 Arrays Continued
Arrays.
Introduction to Arrays in Java Corresponds with Chapter 6 of textbook.
5-Aug-2002cse Arrays © 2002 University of Washington1 Arrays CSE 142, Summer 2002 Computer Programming 1
Chapter 8: Arrays.
Objectives - 11  We will work with processing Arrays.  Objectives:  Describe the concept of an array and its benefits.  Define the terms index, traverse,
Array Cs212: DataStructures Lab 2. Array Group of contiguous memory locations Each memory location has same name Each memory location has same type a.
SINGLE-DIMENSION ARRAYS. Data Structures It is a collection of scalar data types that are all referenced or accessed through one identifier – scalar type.
Web Database Programming Week 3 PHP (2). Functions Group related statements together to serve “a” specific purpose –Avoid duplicated code –Easy maintenance.
Built-in Data Structures in Python An Introduction.
Min Chen School of Computer Science and Engineering Seoul National University Data Structure: Chapter 2.
1 P51UST: Unix and Software Tools Unix and Software Tools (P51UST) Awk Programming (2) Ruibin Bai (Room AB326) Division of Computer Science The University.
Lists and the Collection Interface Chapter 4. 2 The List Interface and ArrayList Class So far, all we have is an array for storing a collection of elements.
Advanced Computer Science Lesson 4: Reviewing Loops and Arrays Reading User Input.
The List ADT A sequence of zero or more elements A 1, A 2, A 3, … A N-1 N: length of the list A 1 : first element A N-1 : last element A i : position i.
Array Objectives To understand the concept of arrays To understand the purpose to which we use arrays. To be able to declare references to arrays. To be.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
Recitation 7 Collections. Array List and Linked List Array List and Linked List are implementations of the same interface: List. As a result, they have.
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Thomas Kuehne.
Programming Fundamentals I Java Programming Spring 2009 Instructor: Xuan Tung Hoang TA: Tran Minh Trung Lab 03.
Programming with Microsoft Visual Basic 2008 Fourth Edition Chapter Eight String Manipulation.
1 Chapter 13-2 Applied Arrays: Lists and Strings Dale/Weems.
Arrays-. An array is a way to hold more than one value at a time. It's like a list of items.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 14 Searching and Sorting.
IT259 Foundation of Programming Using Java Unit 9 Seminar : (Chapter 8 ) Instructor : Vladimir Gubanov, PhD
JAVA COLLECTIONS LIBRARY School of Engineering and Computer Science, Victoria University of Wellington COMP T2, Lecture 2 Marcus Frean.
Sets and Maps Chapter 9. Chapter Objectives  To understand the Java Map and Set interfaces and how to use them  To learn about hash coding and its use.
Chapter 3: Sorting and Searching Algorithms 3.1 Searching Algorithms.
CS 116 Object Oriented Programming II Lecture 4 Acknowledgement: Contains materials provided by George Koutsogiannakis and Matt Bauer.
Notes for Assignment #2 Assn2: GUI Database Interface Corresponds with Chapters 28, 29, 31.
Chapter 16: Searching, Sorting, and the vector Type.
 2003 Prentice Hall, Inc. All rights reserved. 1 Arrays Outline 1 Introduction 2 Arrays 3Declaring Arrays 4Processing Array Contents 5 Multiple-Subscripted.
Sets and Maps Chapter 9.
5.13 Recursion Recursive functions Functions that call themselves
JAVA COLLECTIONS LIBRARY
Dictionaries, File operations
CIS16 Application Development and Programming using Visual Basic.net
Chapter 7 Part 2 Edited by JJ Shepherd
Sets and Maps Chapter 9.
Exercise 5 1. We learned bubble sort during class. This problem requires you to modify the code for bubble sorting method to implement the selection sorting.
Announcements HW1 is due TODAY.
Presentation transcript:

A SSIGNMENT 1: S IMPLE A RRAY IN J AVA Create 2 Class Accessories Class: MyArray.java Implement an array in Class MyArray Implement a series method to access the array Entrance Class: UseArray.java Create a instance of MyArray Get command from user and process it by using the methods provided by Class MyArray

A SSIGNMENT 1: S PECIFICATIONS Requirement of the array 1 dimensional array Length=10 Data type in the array is int Original Data in the array is: { 258, 221, 21, 1, 31, 98, 37, 47, 11, 9 }

A SSIGNMENT 1: S PECIFICATIONS Methods in Class MyArray (Part 1) printArray() Print out all of the items in the array getValue(int index) setValue(int index, int value) int searchValue(int value) Return the index of the value If no found, return 10 Linear Search is enough

A SSIGNMENT 1: S PECIFICATIONS Methods in Class MyArray (Part 2) insertValue(int index, int value) Insert the value to corresponding index Move all the items with higher index values up one position When new element is inserted, the last element in original array will be lost deleteValue(int value) Search the corresponding value and delete it Duplicated values do not need to be deleted but just the first one

A SSIGNMENT 1: S PECIFICATIONS Use Array: Provide a loop in main() which is listening the command from user Design a simple interface for user to input the commands of: Set value in predicted index Get value in predicted index Searching a value (return the index) Insert a value Delete a value Exit the program

A SSIGNMENT 1: F ORMAT Deadline: Jan. 4 th (12:00AM) You need to submit: Java Files Class Files Report (in English) Part 1: Description of the implementation Includes figures about your design Part 2: Result Screenshot

A SSIGNMENT 1: H OW TO SUBMIT ? Send to: Title Format: [DS] Assignment N_XXXX-XXXXXX N is the number of the Assignment XXXX-XXXXXX is your Student ID Attachment should be a zip file with your codes and report