If I have an array type array[x][y] and for x=1 I have 3 different values for y.
How do I delete 1 value from y and maybe restructure the array?
package javaphone;
import java.util.Arrays;
import java.util.Scanner;
public class DeleteContract {
public static void DeleteContract() {
Scanner input = new Scanner(System.in);
System.out.println("Type your VAT number: ");
String vat = input.next();
int index;
boolean result = false;
int i = 0;
while (!result && i < NewCustomer.counter) {
result = (NewCustomer.vats[i].equals(vat));
i++;
}
if (result) {
index = i;
System.out.println("--------Existing Contracts--------");
for (int y = 0; y < NewContract.contractCounter; y++) {
System.out.println("Number: " + NewContract.number[i][y]
+ "Starting Date: " + NewContract.startdate[i][y]
+ "Lenght: " + NewContract.length[i][y]);
}
System.out.println("Which contract you wish to delete?");
int del = input.nextInt();
} else {
System.out.println("There's no registered customer with this VAT.");
return;
}
}
}
This is my code but I didn't want to scare you guys with unknown values to you, but if you understand my code, what I am basically trying to do is delete a contract from a user, where users are basically x and their contracts are y, as you see in my code, every contract is defined by 3 values number, startdate and lenght