Welcome to Incels.is - Involuntary Celibate Forum

Welcome! This is a forum for involuntary celibates: people who lack a significant other. Are you lonely and wish you had someone in your life? You're not alone! Join our forum and talk to people just like you.

JFL ER/EREE/EREE///EEEE/ER/EE/EREE///R/EEEE/E///EEE/EER/ERRE/ERE/E/RR/E///RRE/E/RE/R/E/EREE/RR/ER/RE///E/EREE/EREE/EE/RRR/R///ERE/RRR/REE/RRE/E/ERE/

owly

owly

Banned
-
Joined
Oct 26, 2018
Posts
2,294
ER java morse class :

Code:
package sG;
public class ERMorseClass {
private String user; // click on var and type alt + shift + s then select generate getters setters
public String getUser() {
  return user;
}
public void setUser(String user) {
  this.user = user;
}
private static String lastMsg;
public ERMorseClass(String user) {
  this.user = user;
} // I'm a constructor, use this. if the param names are
// the same as the classes
public String toMorse(String msg) {
  lastMsg = code(msg);
  return this.user + " " + this.lastMsg;
}
public String toHuman(String msg) {
  return this.user + " " + decoder(msg);
}
public static String code(String msg) {
  char[] arr = msg.toCharArray();
  String result = "";
  for (int i = 0; i < arr.length; i++) {
   result += charToMorse(arr[i]);
  }
  return result;
}
private static String charToMorse(char x) {
  String result = "";
  switch (x) {
  case 'a':
   result = "ER";
   break;
  case 'b':
   result = "REEE";
   break;
  case 'c':
   result = "RERE";
   break;
  case 'd':
   result = "REE";
   break;
  case 'e':
   result = "E";
   break;
  case 'f':
   result = "EERE";
   break;
  case 'g':
   result = "RRE";
   break;
  case 'h':
   result = "EEEE";
   break;
  case 'i':
   result = "EE";
   break;
  case 'j':
   result = "ERRR";
   break;
  case 'k':
   result = "RER";
   break;
  case 'l':
   result = "EREE";
   break;
  case 'm':
   result = "RR";
   break;
  case 'n':
   result = "RE";
   break;
  case 'o':
   result = "RRR";
   break;
  case 'p':
   result = "ERRE";
   break;
  case 'q':
   result = "RRER";
   break;
  case 'r':
   result = "ERE";
   break;
  case 's':
   result = "EEE";
   break;
  case 't':
   result = "R";
   break;
  case 'u':
   result = "EER";
   break;
  case 'v':
   result = "EEER";
   break;
  case 'w':
   result = "ERR";
   break;
  case 'x':
   result = "REER";
   break;
  case 'y':
   result = "RERR";
   break;
  case 'z':
   result = "RREE";
   break;
  case '0':
   result = "RRRRR";
   break;
  case '1':
   result = "ERRRR";
   break;
  case '2':
   result = "EERRR";
   break;
  case '3':
   result = "EEERR";
   break;
  case '4':
   result = "EEEER";
   break;
  case '5':
   result = "EEEEE";
   break;
  case '6':
   result = "REEEE";
   break;
  case '7':
   result = "RREEE";
   break;
  case '8':
   result = "RRREE";
   break;
  case '9':
   result = "RRRRE";
   break;
  case '.':
   result = "ERERER";
   break;
  case ',':
   result = "RREERR";
   break;
  case '?':
   result = "EERREE";
   break;
  case ' ':
   result = "/";
   break;
  default:
   break;
  }
  return result + "/";
}
public static String decoder(String msg) {
  String morseChr = "";
  String result = "";
  char[] arr = msg.toCharArray();
  for (int i = 0; i < arr.length; i++) {
   if (arr[i] != '/') {
    morseChr += arr[i];
   } else {
    result += morseCharToChar(morseChr);
    morseChr = "";
   }
  }
  result = result.replaceAll("  ", " ");
  return result;
}
private static char morseCharToChar(String x) {
  char result = '@';
  switch (x) {
  case "ER":
   result = 'a';
   break;
  case "REEE":
   result = 'b';
   break;
  case "RERE":
   result = 'c';
   break;
  case "REE":
   result = 'd';
   break;
  case "E":
   result = 'e';
   break;
  case "EERE":
   result = 'f';
   break;
  case "RRE":
   result = 'g';
   break;
  case "EEEE":
   result = 'h';
   break;
  case "EE":
   result = 'i';
   break;
  case "ERRR":
   result = 'j';
   break;
  case "RER":
   result = 'k';
   break;
  case "EREE":
   result = 'l';
   break;
  case "RR":
   result = 'm';
   break;
  case "RE":
   result = 'n';
   break;
  case "RRR":
   result = 'o';
   break;
  case "ERRE":
   result = 'p';
   break;
  case "RRER":
   result = 'q';
   break;
  case "ERE":
   result = 'r';
   break;
  case "EEE":
   result = 's';
   break;
  case "R":
   result = 't';
   break;
  case "EER":
   result = 'u';
   break;
  case "EEER":
   result = 'v';
   break;
  case "ERR":
   result = 'w';
   break;
  case "REER":
   result = 'x';
   break;
  case "RERR":
   result = 'y';
   break;
  case "RREE":
   result = 'z';
   break;
  case "RRRRR":
   result = '0';
   break;
  case "ERRRR":
   result = '1';
   break;
  case "EERRR":
   result = '2';
   break;
  case "EEERR":
   result = '3';
   break;
  case "EEEER":
   result = '4';
   break;
  case "EEEEE":
   result = '5';
   break;
  case "REEEE":
   result = '6';
   break;
  case "RREEE":
   result = '7';
   break;
  case "RRREE":
   result = '8';
   break;
  case "RRRRE":
   result = '9';
   break;
  case "ERERER":
   result = '.';
   break;
  case "RREERR":
   result = ',';
   break;
  case "EERREE":
   result = '?';
   break;
  case "/":
   result = ' ';
   break;
  default:
   break;
  }
  if (result == '@') {
   result = ' ';
  }
  return result;
}
public static void describeME() {
  System.out.println("I'm a class that can code and decode morse code");
}
}

main class :

Code:
package sG;
public class ERMorse {
public static void main(String[] args) {
  // TODO Auto-generated method stub
  System.out.println(ERMorseClass.code("all hail the supreme gentelman elliot rodger"));
}
}
WTF couldn't access the forum 3sec after posting this
 
Last edited:
ascend with this one simple trick
 
over for javacels
 
include me in the screencap
 

Users who are viewing this thread

shape1
shape2
shape3
shape4
shape5
shape6
Back
Top