import [Link].
*;
class func {
int[] arrValues;
int editableValue;
void insertArray() {
Scanner getInput = new Scanner([Link]);
[Link]("Enter the length of array");
int userInput = [Link]();
arrValues = new int[userInput];
for (int i = 0; i < userInput; i++) {
[Link]("Enter the element no "+(i+1));
arrValues[i] = [Link]();
}
editableValue=[Link];
}
void displayArray() {
[Link]("The inserted arrys are:");
for (int i = 0; i < editableValue; i++) {
[Link](arrValues[i]);
}
}
void deleteArray(){
[Link]("Enter the index of the element you want to delete");
Scanner del = new Scanner([Link]);
int delIndex = [Link]();
for (int i=delIndex;i<[Link]-1;i++){
arrValues[i]=arrValues[i+1];
}
editableValue-=1;
}
void updateArray(){
[Link]("Enter the index of the element you want to update");
Scanner update = new Scanner([Link]);
int updateIndex = [Link]();
[Link]("Enter the value that you want to replace the element with");
int newValue = [Link]();
arrValues[updateIndex]= newValue;
}
void sortArray(){
[Link](arrValues,0,editableValue);
}
void searchArray(){
Scanner searchElement = new Scanner([Link]);
[Link]("Enter the element you want to search");
int searchValue = [Link]();
for (int i = 0; i < [Link]; i++) {
if (arrValues[i]==searchValue){
[Link]("The elemetn you're searching for is in index no "+i+" of the Array");
}
}
}
}
class Main {
public static void main(String[] args) {
func arr = new func();
while (true) {
[Link]("1. Insert");
[Link]("2. Display");
[Link]("3. Delete");
[Link]("4. Update");
[Link]("5. Sort");
[Link]("6. Search");
[Link]("7. Exit");
[Link]("Make your choice");
Scanner sc = new Scanner([Link]);
int choice = [Link]();
switch (choice) {
case 1:
[Link]();
break;
case 2:
[Link]();
break;
case 3:
[Link]();
break;
case 4:
[Link]();
break;
case 5:
[Link]();
break;
case 6:
[Link]();
break;
case 7:
[Link](0);
break;
default:
[Link]("The number you've chosen doesn't perform any [Link] select a
valid number");
}
}
}
}