QDBordtoshred / WEni

MIT License
0 stars 0 forks source link

U3 Hacks Review Ticket #2

Open QDBordtoshred opened 1 year ago

QDBordtoshred commented 1 year ago

Boolean and If Statement Hacks

public class comparing {
public static String compareString(String string1, String string2) {
String bigString = "";
int yeah = string1.compareTo(string2);
if (yeah>0) {
bigString = string1;
}
else if (yeah<0) {
bigString = string2;
}
else {
bigString = "They are the same";
}
return bigString;
}
public static int compareInt(int int1, int int2) {
    int greater = 0;
    if (int1>int2) {
        greater = int1;
    }
    else if (int2>int1) {
        greater = int2;
    }
    return greater;
}

public static void main(String[] args) {
    System.out.println(compareString("no", "yes"));
    System.out.println(compareString("yes", "rag"));
    System.out.println(compareString("yes", "yes"));
    System.out.println(compareInt(17, 23));
}

}
comparing.main(null);

## Weird Questions
!(true)&&(false) = false
not ((((true and not (false)) ^ false) ^ true) && false) = true
!A * !(B + !C) = !A * (!B * C)
!(A + (B + !C)) = !A * !(B + !C)
!(A + (B + !C)) = !(A + (B + !C))
420 && 66
110100100 && 1000010
000000000
Bonus: 89 OR 42
1011001 OR 101010
0001000