may sample codes ka ba dyan papi ?Familiar kasi yan, labexer na naka attach.
Sir please help meron ba kayo dyan copy ng codes ?Sino kaibigan mo?
public class Rome22
{
public static void main(String[] args) {
String employee [][] = {
//employee
{"Zuch ", "Huhg ", "Adam ", "Nathan ", "Erick "},
//department
{"SITE ", "CN ", "COE ", "CBAA ", "CEDE "},
};
int column = 5;
int row = 1;
//Save the 2D array into 1D array but only the names
String[] employee1D = new String[column];
int it = 0;
for(int i = 0; i < row ; i++) {
for(int j = 0 ; j < column ; j++) {
employee1D[it] = employee[i][j];
it++;
}
}
//Sort the 1D array
for(int i = 0 ; i < employee1D.length - 1; i++) {
for(int j = i + 1 ; j < employee1D.length ; j++) {
if(employee1D[i].compareTo(employee1D[j]) > 0) {
String temp = employee1D[i];
employee1D[i] = employee1D[j];
employee1D[j] = temp;
}
}
}
//Print the 2D sorted Array
System.out.println("Name\t\t\tDepartment");
int x = 0; // use to iterate the 1D array
for(int i = 0 ; i <= 2 ; i++) {
for(int j = 0 ; j < column; j++) {
//Check if the Sorted 1D array is equal to the names in 2D array to get the corresponding Department
if(employee[0][j].equals(employee1D[x])) {
System.out.println(employee1D[x] +"\t\t\t"+ employee[1][j]);
if(x < 4)
x++;
}
}
}
}
}
Thanks lods your da besteto ts pa try nalang
Java:public class Rome22 { public static void main(String[] args) { String employee [][] = { //employee {"Zuch ", "Huhg ", "Adam ", "Nathan ", "Erick "}, //department {"SITE ", "CN ", "COE ", "CBAA ", "CEDE "}, }; int column = 5; int row = 1; //Save the 2D array into 1D array but only the names String[] employee1D = new String[column]; int it = 0; for(int i = 0; i < row ; i++) { for(int j = 0 ; j < column ; j++) { employee1D[it] = employee[i][j]; it++; } } //Sort the 1D array for(int i = 0 ; i < employee1D.length - 1; i++) { for(int j = i + 1 ; j < employee1D.length ; j++) { if(employee1D[i].compareTo(employee1D[j]) > 0) { String temp = employee1D[i]; employee1D[i] = employee1D[j]; employee1D[j] = temp; } } } //Print the 2D sorted Array System.out.println("Name\t\t\tDepartment"); int x = 0; // use to iterate the 1D array for(int i = 0 ; i <= 2 ; i++) { for(int j = 0 ; j < column; j++) { //Check if the Sorted 1D array is equal to the names in 2D array to get the corresponding Department if(employee[0][j].equals(employee1D[x])) { System.out.println(employee1D[x] +"\t\t\t"+ employee[1][j]); if(x < 4) x++; } } } } }

Pero di pwedeng ipasa nalang, dapat pag aralan mo din yanThanks lods your da best![]()
Yes mam sorry delay response salamat sa pag pansinjava lang po alam ko. e sosorting po ba with name and there department?

Sige lods sensya wala pa kong fundamentals sa java eh tinulungan ko lang kaibigan start palang ako with visual basic at C++ pero lods dadating din ako dyanPero di pwedeng ipasa nalang, dapat pag aralan mo din yan
