Skip to content

Commit

Permalink
Workign Code with Partial Letter Translator
Browse files Browse the repository at this point in the history
  • Loading branch information
Bonesbhbhbh committed Sep 23, 2024
1 parent 01e1297 commit 97b94a7
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions main.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Armando and El
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -14,10 +15,13 @@ public static void main(String[] args){
// int[][] programerPreferences = new int[pro][pro];
// int[][] companyPreferences = new int[pro][pro];
int[][] programerPreferences = {{1, 2, 0}, {0, 1 , 2}, {2, 1, 0}};
int[][] companyPreferences = {{1,2,0},{0,1,2},{2,1,0}};
char[][] companyPreferences = {{'a','b','c'}, {'c','b','a'}, {'b','c','a'}};
int[][] companyPreferencesTranslated = {{1,2,0},{0,1,2},{2,1,0}};

char[] alphabet = {'a', 'b' , 'c', 'd', 'e', 'f', 'g'};



// for(int i = 0; i < pro; i++){
// System.out.println("Insert preferences for programmer " + i );
// for(int j = 0; j < pro; j++){
Expand All @@ -33,7 +37,7 @@ public static void main(String[] args){
// }
s.close();

int[] matches = match(programerPreferences, companyPreferences);
int[] matches = match(programerPreferences, companyPreferencesTranslated);

System.out.println("Preferences in Array form \nprogramers: companies:");
for (int i = 0; i < pro; i++) {
Expand All @@ -51,6 +55,16 @@ public static void main(String[] args){
System.out.println(matches[i]);
}
}
public static int[][] translator(char[][] companyPreferences, char[] alphabet){
int[][] companyPreferencesTranslated = new int[companyPreferences.length][companyPreferences[0].length];
for (int i = 0; i < companyPreferences.length; i++) {
for (int j = 0; j < companyPreferences[0].length; j++) {
char c = (char) companyPreferences[i][j];
companyPreferencesTranslated[i][j] = c;
}
}
return companyPreferencesTranslated;
}

static int[] match(int[][] programerPreferences, int[][] companyPreferences) {
Map<Integer, Integer> temp = new HashMap<>();
Expand Down

0 comments on commit 97b94a7

Please sign in to comment.