Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 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

2 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 }

3 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

4 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

5 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

6 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

7 A SSIGNMENT 1: H OW TO SUBMIT ? Send email to: DS2009winter@gmail.com 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


Download ppt "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."

Similar presentations


Ads by Google