Skip to content

Instantly share code, notes, and snippets.

@lusy
Created June 3, 2022 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lusy/b54ada85d5c2d56b650037aa5435a727 to your computer and use it in GitHub Desktop.
Save lusy/b54ada85d5c2d56b650037aa5435a727 to your computer and use it in GitHub Desktop.
public class BTables3 {
public static void main(String[]args){
System.out.println(evaluateBs(false,false,false));
System.out.println(evaluateBs(false,true,false));
}
/**
* Die gibt den Wahrheitswert gemäß der vorgegeben Wahrheitstabelle (siehe Beschreibung) zurück.
*
* @param x1 Boolescher Wert
* @param x2 Boolescher Wert
* @param x3 Boolescher Wert
* @return Das Ergebnis gemäß Wahrheitstabelle
*/
public static boolean evaluateBs(boolean x1, boolean x2, boolean x3){
boolean ergebnis = false || true;
if(x1== false && x2== false && x3 == false){
return ergebnis = false;
}
if(x1== false && x2== false && x3 == true){
return ergebnis = false;
}
if(x1== false && x2== true && x3 == false){
return ergebnis = false;
}
if(x1== false && x2== true && x3 == true){
return ergebnis = true;
}
if(x1== true && x2== false && x3 == false){
return ergebnis = true;
}
if(x1== true && x2== false && x3 == true){
return ergebnis = true;
}
if(x1== true && x2== true && x3 == false){
return ergebnis = false;
}
if(x1== true && x2== true && x3 == true){
return ergebnis = false;
}
return ergebnis;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment