A SSIGNMENT 1: S IMPLE A RRAY IN J AVA Create 2 Class Accessories Class: MyArray.java Implement an...

7
ASSIGNMENT 1: SIMPLE ARRAY IN JAVA 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

Transcript of A SSIGNMENT 1: S IMPLE A RRAY IN J AVA Create 2 Class Accessories Class: MyArray.java Implement an...

Page 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.

ASSIGNMENT 1: SIMPLE ARRAY IN JAVA

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

Page 2: 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.

ASSIGNMENT 1: SPECIFICATIONS

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 }

Page 3: 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.

ASSIGNMENT 1: SPECIFICATIONS

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

Page 4: 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.

ASSIGNMENT 1: SPECIFICATIONS

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

Page 5: 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.

ASSIGNMENT 1: SPECIFICATIONS

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

Page 6: 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.

ASSIGNMENT 1: FORMAT

Deadline: Jan. 4th (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

Page 7: 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.

ASSIGNMENT 1: HOW TO SUBMIT?

Send email to: [email protected]

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