Program propositional (kelas 3H)

Program propositional bagi kelas 3H

  1. Silahkan menuliskan program propositional menggunakan bahasa apapun baik Java, C, C++, Pascal, Basic, dan sebagainya di bagian komentar.
  2. Jangan lupa menuliskan nama dan NIM anda.
  3. Ingat perhatikan baik-baik kelas anda, selain program / koding tuliskan hasilnya dari alur program yang anda tulis.

50 Responses

  1. package logika;
    import java.util.Scanner;
    import java.io.*;

    public class LogikaProposisi {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” DAN “+st2);
    System.out.println(“A \u22c1 B : “+st+” ATAU “+st2);
    System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

  2. package logika;
    import java.util.Scanner;
    import java.io.*;

    public class LogikaProposisi {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” DAN “+st2);
    System.out.println(“A \u22c1 B : “+st+” ATAU “+st2);
    System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

  3. //ferdy riyanda
    //09.11.3120
    //siti 3H
    #include
    #include
    #include

    int main()
    {
    char statea[90];
    char stateb[90];

    cout <> statea;
    cout <> stateb;

    cout << "\nAND\t\t" << statea << " dan " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "OR\t\t" << statea << " atau " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "NOT\t\t" << "tidak " << statea << endl;
    cout << "——————————————————–" << endl;
    cout << "XOR\t\t" << “tidak” << statea << " dan " << stateb << “atau” << statea << “dan” << ”tidak” << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFTHEN\t\t" << "jika " << statea << " maka " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFONLYIF\t" << statea << " jika dan hanya jika " << stateb << endl;
    getch();
    }

  4. //Toni Setyawan
    //nim: 09.11.3131
    //S1TI 3H

    #include
    #include
    #include

    int main()
    {
    char statea[90];
    char stateb[90];

    cout <> statea;
    cout <> stateb;

    cout << "\nAND\t\t" << statea << " dan " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "OR\t\t" << statea << " atau " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "NOT\t\t" << "tidak " << statea << endl;
    cout << "——————————————————–" << endl;
    cout << "XOR\t\t" << “tidak” << statea << " dan " << stateb << “atau” << statea << “dan” << ”tidak” << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFTHEN\t\t" << "jika " << statea << " maka " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFONLYIF\t" << statea << " jika dan hanya jika " << stateb << endl;
    getch();
    }

  5. #include
    #include
    #include

    int main()
    {
    char statea[90];
    char stateb[90];

    cout <> statea;
    cout <> stateb;

    cout << "\nAND\t\t" << statea << " dan " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "OR\t\t" << statea << " atau " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "NOT\t\t" << "tidak " << statea << endl;
    cout << "——————————————————–" << endl;
    cout << "XOR\t\t" << “tidak” << statea << " dan " << stateb << “atau” << statea << “dan” << ”tidak” << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFTHEN\t\t" << "jika " << statea << " maka " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFONLYIF\t" << statea << " jika dan hanya jika " << stateb << endl;
    getch();
    }

  6. //Nama: Media Yusuf Winarko
    //NIM: 09.11.3153
    //Kelas: S1TI3H

    #include
    #include
    #include

    int main()
    {
    char statea[90];
    char stateb[90];

    cout <> statea;
    cout <> stateb;

    cout << "\nAND\t\t" << statea << " dan " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "OR\t\t" << statea << " atau " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "NOT\t\t" << "tidak " << statea << endl;
    cout << "——————————————————–" << endl;
    cout << "XOR\t\t" << “tidak” << statea << " dan " << stateb << “atau” << statea << “dan” << ”tidak” << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFTHEN\t\t" << "jika " << statea << " maka " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFONLYIF\t" << statea << " jika dan hanya jika " << stateb << endl;
    getch();
    }

  7. // NAMA : AKHMAD NOOR
    //NIM : 09.11.3122
    //KELAS : S1TI 3H

    #include
    #include
    #include

    int main()
    {
    char statea[90];
    char stateb[90];

    cout <> statea;
    cout <> stateb;

    cout << "\nAND\t\t" << statea << " dan " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "OR\t\t" << statea << " atau " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "NOT\t\t" << "tidak " << statea << endl;
    cout << "——————————————————–" << endl;
    cout << "XOR\t\t" << “tidak” << statea << " dan " << stateb << “atau” << statea << “dan” << ”tidak” << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFTHEN\t\t" << "jika " << statea << " maka " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFONLYIF\t" << statea << " jika dan hanya jika " << stateb << endl;
    getch();
    }

  8. // NAMA : Muh. Arif Tirtana A
    // NIM : 09.11.3129
    // Kelas : S1 TI 3H

    #include
    #include
    #include

    int main()
    {
    char statea[90];
    char stateb[90];

    cout <> statea;
    cout <> stateb;

    cout << "\nAND\t\t" << statea << " dan " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "OR\t\t" << statea << " atau " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "NOT\t\t" << "tidak " << statea << endl;
    cout << "——————————————————–" << endl;
    cout << "XOR\t\t" << “tidak” << statea << " dan " << stateb << “atau” << statea << “dan” << ”tidak” << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFTHEN\t\t" << "jika " << statea << " maka " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFONLYIF\t" << statea << " jika dan hanya jika " << stateb << endl;
    getch();
    }

  9. // nama : RIZQI FITRIANSYAH ANTASARI
    // nim : 09.11.3133

    #include
    #include
    #include

    int main()
    {
    char statea[90];
    char stateb[90];

    cout <> statea;
    cout <> stateb;

    cout << "\nAND\t\t" << statea << " dan " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "OR\t\t" << statea << " atau " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "NOT\t\t" << "tidak " << statea << endl;
    cout << "——————————————————–" << endl;
    cout << "XOR\t\t" << “tidak” << statea << " dan " << stateb << “atau” << statea << “dan” << ”tidak” << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFTHEN\t\t" << "jika " << statea << " maka " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFONLYIF\t" << statea << " jika dan hanya jika " << stateb << endl;
    getch();
    }

  10. Nama : Akbar Hartomo
    NIM : 09.11.3128

    #include
    #include
    #include

    int main()
    {
    char statea[90];
    char stateb[90];

    cout <> statea;
    cout <> stateb;

    cout << "\nAND\t\t" << statea << " dan " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "OR\t\t" << statea << " atau " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "NOT\t\t" << "tidak " << statea << endl;
    cout << "——————————————————–" << endl;
    cout << "XOR\t\t" << “tidak” << statea << " dan " << stateb << “atau” << statea << “dan” << ”tidak” << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFTHEN\t\t" << "jika " << statea << " maka " << stateb << endl;
    cout << "——————————————————–" << endl;
    cout << "IFONLYIF\t" << statea << " jika dan hanya jika " << stateb << endl;
    getch();
    }

  11. # include
    # include

    void main ()
    {
    char kalimatA [ 50 ] ;
    char kalimatB [ 50 ] ;

    cout<<" Program Proposisional\n"; //Judul
    cout<<" =====================\n";
    cout<<"\nMasukkan kalimat A : ";//input kalimatA
    cin.getline (kalimatA, sizeof (kalimatA)) ;
    cout<<"Masukkan kalimat B : ";//input kalimatB
    cin.getline (kalimatB, sizeof(kalimatB)) ;

    cout << "\n\nFungsi Conjungsi :" <<kalimatA<<" dan "<<kalimatB<<endl;
    cout << "\nFungsi Disjungsi :" <<kalimatA<<" atau "<<kalimatB<<endl;
    cout << "\nFungsi Condisional :" <<"Jika "<<kalimatA<<", Maka "<<kalimatB<<endl;
    cout << "\nFungsi Bicondisional :" <<kalimatA<<" Jika dan Hanya Jika "<<kalimatB<<endl;
    cout << "\nFungsi Exclusive Or :" <<kalimatA<<" Exlusive Or "<<kalimatB<<endl;
    getch();
    }

    // ALFURQAAN KIBRIL
    // 09.11.3104
    //

  12. // Nama : Agus joko S
    //Nim : 09.11.3132
    //Kelas : S1.TI.3H

    # include
    # include
    void main ()
    {
    char kalimat1 [ 40 ] ;
    char kalimat2 [ 40 ] ;
    char kalimat2 [ 40 ];
    cout<<" Logika Proporsitional\n";
    cout<<”===================\n”;

    cout<<"Masukkan kalimat pertama : ";//input kalimat 1
    cin.getline (kalimat1, sizeof (kalimat1)) ;
    cout<<"Masukkan kalimat kedua : ";//input kalimat 2
    cin.getline (kalimat2, sizeof(kalimat2)) ;
    cout<<"Masukkan kalimat ketiga : ";//input kalimat 3
    cin.getline (kalimat3, sizeof(kalimat3)) ;

    cout <<”\n Fungsi Negasi : not “kalimat1”;
    cout <<”\n Fungsi Negasi : not “kalimat2”;
    cout << "\nFungsi Conjunction :" <<kalimat1<<" dan "<<kalimat2<<endl;
    cout << "\nFungsi Disjunction :" <<kalimat1<<" atau "<<kalimat2<<endl;
    cout << "\nFungsi Implication :" <<"Jika "<<kalimat1<<", Maka "<<kalimat2<<endl;
    cout << "\nFungsi Equivalensi :" <<kalimat1<<" Jika dan Hanya Jika "<<kalimat2<<endl;
    cout << "\nFungsi Conditional :" <<”jika”<<kalimat1<<" Maka "<<kalimat2<<”else”<<kalimat3<<endl;
    getch();
    }

  13. package logika;
    import java.util.Scanner;
    import java.io.*;

    public class LogikaProposisi {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” dan “+st2);
    System.out.println(“A \u22c1 B : “+st+” atau “+st2);
    System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

  14. NIM : 09.11.3111
    Kelas : S1TI-3H

    import java.io.*;
    public class mathdisk{
    public static void main(String[] args){
    BufferedReader dataIn = new BufferedReader (new InputStreamReader (System.in));

    String n = “”;
    String m = “”;

    System.out.print(“MASUKAN 1 : “);
    try{
    n = dataIn.readLine();
    }
    catch (IOException e){
    System.out.println(“Error!”);
    }

    System.out.print(“MASUKAN 2 : “);
    try{
    m = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Error!”);
    }

    System.out.println(“”);
    System.out.println(“==== HASIL ====”);
    System.out.println(“”);
    System.out.println(n + ” DAN ” + m + “”);
    System.out.println(n + ” ATAU ” + m + “”);
    System.out.println(“JIKA ” + n + ” MAKA ” + m + “”);
    System.out.println(n + ” JIKA DAN HANYA JIKA ” + m + “”);
    }
    }

  15. import java.io.*;
    public class matematikaDiskrit{
    public static void main(String[] args){
    BufferedReader dataIn = new BufferedReader (new InputStreamReader (System.in));

    String x = “”;
    String y = “”;

    System.out.print(“Masukkan inputan 1 :”);
    try{
    x = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.print(“Masukkan inputan 2 :”);
    try{
    y = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.println(“—-Hasil—-“);
    System.out.println(x + ” DAN ” + y + “”);
    System.out.println(x + ” ATAU ” + y + “”);
    System.out.println(“JIKA ” + x + ” MAKA ” + y + “”);
    System.out.println(x + ” JIKA DAN HANYA JIKA ” + y + “”);

    }
    }

  16. import java.io.*;
    public class matematikaDiskrit{
    public static void main(String[] args){
    BufferedReader dataIn = new BufferedReader (new InputStreamReader (System.in));

    String x = “”;
    String y = “”;

    System.out.print(“Masukkan inputan 1 :”);
    try{
    x = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Error!”);
    }

    System.out.print(“Masukkan inputan 2 :”);
    try{
    y = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.println(“—-Hasil—-“);
    System.out.println(x + ” Dan ” + y + “”);
    System.out.println(x + ” Atau ” + y + “”);
    System.out.println(“Jika ” + x + ” Maka ” + y + “”);
    System.out.println(x + ” Jika dan hanya jika ” + y + “”);

    }
    }

  17. //Nama : Alfian B. Pratama
    //NIM : 09.11.3093
    //Kelas : S1 TI – 3H

    #include
    #include
    #include

    void main()
    {
    char F,f,p,q,T,t;
    cout<<" Program Proporsitional\n";
    cout<<"==========================\n";
    cout<>p;endl;
    cout<>q;endl;endl;
    cout<<"\n\nFungsi Conjunction (And)\n";endl;
    if(p==T,t&&q==T,t)
    {
    cout<<" (P And Q = T And T) \n bernilai : True";
    }
    else if(p==T,t&&q==F,f)
    {
    cout<<" (P And Q = T And F) \n bernilai : False";
    }
    else if(p==F,f&&q==T,t)
    {
    cout<<" (P And Q = F And T) \n bernilai : False";
    }
    else if(p==F,f&&q==F,f)
    {
    cout<<" (P And Q = F And F) \n bernilai : False";
    }
    cout<<"\n\nFungsi Disjunction (Or)\n";endl;
    if(p==T,t&&q==T,t)
    {
    cout<<" (P Or Q = T Or T) \n bernilai : True";
    }
    else if(p==T,t&&q==F,f)
    {
    cout<<" (P Or Q = T Or F) \n bernilai : True";
    }
    else if(p==F,f&&q==T,t)
    {
    cout<<" (P Or Q = F Or T) \n bernilai : True";
    }
    else if(p==F,f&&q==F,f)
    {
    cout<<" (P Or Q = F Or F) \n bernilai : False\n";
    }
    cout<<"\n\nFungsi Conditional (If-Then)\n";endl;
    if(p==T,t&&q==T,t)
    {
    cout<<" (If P Then Q = If T Then T) \n bernilai : True";
    }
    else if(p==T,t&&q==F,f)
    {
    cout<<" (If P Then Q = If T Then F) \n bernilai : False";
    }
    else if(p==F,f&&q==T,t)
    {
    cout<<" (If P Then Q = If F Then T) \n bernilai : True";
    }
    else if(p==F,f&&q==F,f)
    {
    cout<<" (If P Then Q = If F Then F) \n bernilai : True\n";
    }
    cout<<"\n\nFungsi BiConditional (If and only if)\n";endl;
    if(p==T,t&&q==T,t)
    {
    cout<<" (P If and only if Q = T If and only if T) \n bernilai : True";
    }
    else if(p==T,t&&q==F,f)
    {
    cout<<" (P If and only if Q = T If and only if F) \n bernilai : False";
    }
    else if(p==F,f&&q==T,t)
    {
    cout<<" (P If and only if Q = F If and only if T) \n bernilai : False";
    }
    else if(p==F,f&&q==F,f)
    {
    cout<<" (P If and only if Q = F If and only if F) \n bernilai : True\n";
    }
    cout<<"\n\nFungsi Xor (Exclusive Or)\n";endl;
    if(p==T,t&&q==T,t)
    {
    cout<<" (P Xor Q = T Xor T) \n bernilai : False";
    }
    else if(p==T,t&&q==F,f)
    {
    cout<<" (P Xor Q = T Xor F) \n bernilai : True";
    }
    else if(p==F,f&&q==T,t)
    {
    cout<<" (P Xor Q = F Xor T) \n bernilai : True";
    }
    else if(p==F,f&&q==F,f)
    {
    cout<<" (P Xor Q = F Xor F) \n bernilai : False\n";
    }
    getch();
    }

  18. //Program Proposisi matematika diskret//
    import java.io.*;
    public class matdis{
    public static void main(String[] args){
    BufferedReader dataIn = new BufferedReader (new InputStreamReader (System.in));

    String x = “”;
    String y= “”;

    System.out.print(“MASUKAN 1 :”);
    try{
    x = dataIn.readLine();
    }
    catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.print(“MASUKAN 2 :”);
    try{
    y = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.println(“”);
    System.out.println(“****Hasil****”);
    System.out.println(“”);
    System.out.println(x + ” DAN ” + y + “”);
    System.out.println(x + ” ATAU ” + y + “”);
    System.out.println(“JIKA ” + x + ” MAKA ” + y + “”);
    System.out.println(x + ” JIKA DAN HANYA JIKA ” + y + “”);
    }
    }

  19. //Program Proposisi matematika diskret//
    import java.io.*;
    public class matdis{
    public static void main(String[] args){
    BufferedReader dataIn = new BufferedReader (new InputStreamReader (System.in));

    String p = “”;
    String q= “”;

    System.out.print(“INPUTAN 1 :”);
    try{
    p = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.print(“INPUTAN 2 :”);
    try{
    q = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.println(“”);
    System.out.println(“=====Hasil=====”);
    System.out.println(“”);
    System.out.println(p + ” DAN ” + q + “”);
    System.out.println(p + ” ATAU ” + q + “”);
    System.out.println(“JIKA ” + p + ” MAKA ” + q + “”);
    System.out.println(p + ” JIKA DAN HANYA JIKA ” + q + “”);

    }
    }

  20. Nama : Maria Magdalena Seuk Tae
    Nim : 09.11.3339
    Kelas : S1TI-3K
    Tugas : Matematika Diskret

    Membuat Pseudopalindrome Dan palindrome dengan Menggunakan program Java.

    1. pseudopalindrome

     INPUTAN:

    package palindrome;

    public class Palindrome {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = “”;
    String tmp2 = “”;

    System.out.println(“Masukan Kata : “);
    tmp1 = “MADAM”;

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Termasuk Pseudopalindrome : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Termasuk Palindrome : ");
    System.out.println(tmp2);
    }
    }
    }

     OUTPUT :

    run:
    Masukan Kata :
    Termasuk Pseudopalindrome : MADAM

    2. Palindrome

     INPUT

    package palindrome;

    public class Palindrome {
    public static void main(String[] args) {
    int i = 0;
    String tmp1 = "";
    String tmp2 = "";

    System.out.println("Masukan Kata : ");
    tmp1 = "AMIKOM";

    for (i = 0; i < tmp1.length(); i++) {
    tmp2 = tmp1.substring(i, i + 1) + tmp2;
    }

    if (tmp1.matches(tmp2)) {
    System.out.print("Termasuk Pseudopalindrome : ");
    System.out.println(tmp1);
    } else {
    System.out.print("Termasuk Palindrome : ");
    System.out.println(tmp2);
    }
    }
    }

     OUTPUT

    run:
    Masukan Kata :
    Termasuk Palindrome : MOKIMA

  21. Nama : Hadi Triyono
    NIM : 09.11.3150
    Kelas : S1 TI 3H
    Bahasa : Java

    //Program :
    import java.io.*;

    public class Logika {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A and B : “+st+” DAN “+st2);
    System.out.println(“A or B : “+st+” ATAU “+st2);
    System.out.println(“A implikasi B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A biimplikasi B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }
    }

    //Output :
    A = aku suka kamu
    B = kamu cantik

    A and B : aku suka kamu DAN kamu cantik
    A or B : aku suka kamu ATAU kamu cantik
    A implikasi B : JIKA aku suka kamu MAKA kamu cantik
    A biimplikasi B : aku suka kamu JIKA DAN HANYA JIKA kamu cantik

  22. Nama : Kodir Mahmud
    NIM : 09.11.3144
    Kelas : S1 TI 3H
    Bahasa : Java

    //Program :
    import java.io.*;

    public class Logika {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A and B : “+st+” DAN “+st2);
    System.out.println(“A or B : “+st+” ATAU “+st2);
    System.out.println(“A implikasi B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A biimplikasi B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }
    }

    //Output :
    A = Mahmud tidur
    B = Mahmud ngantuk
    A and B : Mahmud tidur DAN Mahmud ngantuk
    A or B : Mahmud tidur ATAU Mahmud ngantuk
    A implikasi B : JIKA Mahmud tidur MAKA Mahmud ngantuk
    A biimplikasi B : Mahmud tidur JIKA DAN HANYA JIKA Mahmud ngantuk

  23. Nama : Sheru Wulung
    NIM : 09.11.3127
    Kelas : S1 TI 3H
    Bahasa : Java

    //Script Program :

    import java.io.*;

    public class Logika {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A and B : “+st+” DAN “+st2);
    System.out.println(“A or B : “+st+” ATAU “+st2);
    System.out.println(“A implikasi B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A biimplikasi B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

    //Contoh Output :
    A = Hujan Deras
    B = Awan Mendung

    A and B : Hujan Deras DAN Awan Mendung
    A or B : Hujan Deras ATAU Awan Mendung
    A implikasi B : JIKA Hujan Deras MAKA Awan Mendung
    A biimplikasi B : Hujan Deras JIKA DAN HANYA JIKA Awan Mendung

  24. package logika;
    import java.util.Scanner;
    import java.io.*;

    public class Logika {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“X= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“Y= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“X \u22c0 Y : “+st+” DAN “+st2);
    System.out.println(“X \u22c1 Y : “+st+” ATAU “+st2);
    System.out.println(“X \u2192 Y : JIKA “+st+” MAKA “+st2);
    System.out.println(“X \u2194 Y : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

  25. package propositional;

    import java.io.*;

    public class Propositional {

    /**
    * @param args
    */
    public static void main(String[] args) {

    System.out.print(“************LOGIKA PROPOSITIONAL SEDERHANA ***********\n\n”);
    System.out.print(“insert first line : “);
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String nama1 = null;
    try {
    nama1 = br.readLine();
    } catch(IOException ioe) {
    System.out.println(“Kesalahan IO “);
    System.exit(1);
    }
    System.out.print(“insert second line : “);
    String nama2 = null;
    try {
    nama2 = br.readLine();
    } catch(IOException ioe) {
    System.out.println(“Kesalahan IO”);
    System.exit(1);
    }
    System.out.print(“insert third line : “);
    String nama3 = null;
    try {
    nama3 = br.readLine();
    } catch(IOException ioe) {
    System.out.println(“Kesalahan IO “);
    System.exit(1);
    }

    System.out.println(“p = ” + nama1);
    System.out.println(“q = ” + nama2);
    System.out.println(“r = ” + nama3);
    System.out.println(“^ = and”);
    System.out.println(“v = or “);
    System.out.println(“* = not”);
    System.out.println(“-> = then”);
    System.out.println(” = if an only if”);

    System.out.println(“\n INSERT THE FORMULAS : \n” );
    String input =null;
    try{
    input = br.readLine();

    String kata = new String(input);
    for(int i =0 ;i = then
    = if an only if

    INSERT THE FORMULAS :

    *rv(pvr)->(qp)^r
    not
    aku tidak membeli handphone
    or
    {
    aku membeli baju
    or
    aku tidak membeli handphone
    }
    then
    {
    aku membeli sepatu
    if and only if
    aku membeli baju
    }
    and
    aku tidak membeli handphone*/
    /*NAMA : JOULLE VIOLLETTA
    * NIM :09.11.3087
    * KELAS:S1TI-3H
    * TUGAS MATEMATIKA DISKRIT
    * PROGRAM LOGIKA PROPOSISIONAL
    */

  26. package logika;
    import java.util.Scanner;
    import java.io.*;

    public class LogikaProposisi {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” dan”+st2);
    System.out.println(“A \u22c1 B : “+st+” atau “+st2);
    System.out.println(“A \u2192 B : jika “+st+” maka”+st2);
    System.out.println(“A \u2194 B : “+st+” jika dan maka “+st2);

    }

  27. /*NAMA : JOULLE VIOLLETTA
    * NIM :09.11.3087
    * KELAS:S1TI-3H
    * TUGAS MATEMATIKA DISKRIT
    * PROGRAM LOGIKA PROPOSISIONAL
    */

    package propositional;

    import java.io.*;

    public class Propositional {

    /**
    * @param args
    */
    public static void main(String[] args) {

    System.out.print(“************LOGIKA PROPOSITIONAL SEDERHANA ***********\n\n”);
    System.out.print(“insert first line : “);
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String nama1 = null;
    try {
    nama1 = br.readLine();
    } catch(IOException ioe) {
    System.out.println(“Kesalahan IO “);
    System.exit(1);
    }
    System.out.print(“insert second line : “);
    String nama2 = null;
    try {
    nama2 = br.readLine();
    } catch(IOException ioe) {
    System.out.println(“Kesalahan IO”);
    System.exit(1);
    }
    System.out.print(“insert third line : “);
    String nama3 = null;
    try {
    nama3 = br.readLine();
    } catch(IOException ioe) {
    System.out.println(“Kesalahan IO “);
    System.exit(1);
    }

    System.out.println(“p = ” + nama1);
    System.out.println(“q = ” + nama2);
    System.out.println(“r = ” + nama3);
    System.out.println(“^ = and”);
    System.out.println(“v = or “);
    System.out.println(“* = not”);
    System.out.println(“-> = then”);
    System.out.println(” = if an only if”);

    System.out.println(“\n INSERT THE FORMULAS : \n” );
    String input =null;
    try{
    input = br.readLine();

    String kata = new String(input);
    for(int i =0 ;i = then
    = if an only if

    INSERT THE FORMULAS :

    *rv(pvr)->(qp)^r
    not
    aku tidak membeli handphone
    or
    {
    aku membeli baju
    or
    aku tidak membeli handphone
    }
    then
    {
    aku membeli sepatu
    if and only if
    aku membeli baju
    }
    and
    aku tidak membeli handphone*/

  28. package logika;
    import java.util.Scanner;
    import java.io.*;

    public class LogikaProposisi {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” DAN “+st2);
    System.out.println(“A \u22c1 B : “+st+” ATAU “+st2);
    System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

  29. // NAMA : DIMAS SATYA WIRATAMA

    // NIM : 09.11.3107

    // KELAS : S1TI3H

    #include

    #include

    main()

    {

    char inputan1 [100];

    char inputan2 [100];

    cout <<" TUGAS MATEMATIKA DISKRIT" << endl;

    cout <<"=============================================" << endl;

    cout <> inputan1;

    cout <> inputan2;

    clrscr();

    cout << "1. " << inputan1 << " dan " << inputan2 << endl;

    cout << "2. " << inputan1 << " atau " << inputan2 << endl;

    cout << "3. " << "jika " << inputan1 << " maka " << inputan2 << endl;

    cout << "4. " << inputan1 << " jika dan hanya jika " << inputan2 << endl;

    

    getch();

    return 0;

    }

  30. //Rizqi agung Sedayu
    //09.11.3141
    //S1Ti3h

    import java.io.*;
    public class agung{
    public static void main(String[] args){
    BufferedReader dataIn = new BufferedReader (new InputStreamReader (System.in));

    String x = “”;
    String y = “”;

    System.out.print(“masukan 1 :”);
    try{
    x = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.print(“masukan 2 :”);
    try{
    y = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.println(“—-Hasil—-“);
    System.out.println(x + ” DAN ” + y + “”);
    System.out.println(x + ” ATAU ” + y + “”);
    System.out.println(“JIKA ” + x + ” MAKA ” + y + “”);
    System.out.println(x + ” JIKA DAN HANYA JIKA ” + y + “”);

    }
    }

  31. import java.io.*;
    public class agung{
    public static void main(String[] args){
    BufferedReader dataIn = new BufferedReader (new InputStreamReader (System.in));

    String x = “”;
    String y = “”;

    System.out.print(“masukan 1 :”);
    try{
    x = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.print(“masukan 2 :”);
    try{
    y = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.println(“—-Hasil—-“);
    System.out.println(x + ” DAN ” + y + “”);
    System.out.println(x + ” ATAU ” + y + “”);
    System.out.println(“JIKA ” + x + ” MAKA ” + y + “”);
    System.out.println(x + ” JIKA DAN HANYA JIKA ” + y + “”);

    }
    }

  32. //Bayu saputra
    //09.11.3160
    //S1Ti3H

    import java.io.*;
    public class InitMahasiswa{
    public static void main(String[] args){
    BufferedReader dataIn = new BufferedReader (new InputStreamReader (System.in));

    String A = “”;
    String B = “”;

    System.out.print(“INPUTAN 1 :”);
    try{
    A = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.print(“INPUTAN 2 :”);
    try{
    B = dataIn.readLine();
    }catch (IOException e){
    System.out.println(“Eror!”);
    }

    System.out.println(“—-Hasil—-“);
    System.out.println(A + ” DAN ” + B + “”);
    System.out.println(A + ” ATAU ” + B + “”);
    System.out.println(“JIKA ” + A + ” MAKA ” + B + “”);
    System.out.println(A + ” JIKA DAN HANYA JIKA ” + B + “”);

    }
    }

  33. //Harry yuda hanggoro
    //09.11.3152
    //S1Ti3H

    import java.io.*;

    public class matDisk

    {

    public static void main(String[] args)
    {

    BufferedReader dataIn = new BufferedReader (new InputStreamReader (System.in));

    String A = “”;
    String B = “”;

    System.out.print(“Masukan Kalimat Ke 1 : “);

    try

    {

    A = dataIn.readLine();

    }

    catch (IOException e)

    {

    System.out.println(“Eror!”);
    }

    System.out.print(“Masukan Kalimat Ke 2 : “);
    try

    {

    B = dataIn.readLine();

    }

    catch (IOException e)

    {

    System.out.println(“Eror!”);
    }

    System.out.println(“=======================================”);
    System.out.println(“————-Keluarannya—————“);

    System.out.println(A + ” ATAU ” + B + “”);

    System.out.println(A + ” DAN ” + B + “”);

    System.out.println(A + ” JIKA DAN HANYA JIKA ” + B + “”);

    System.out.println(“JIKA ” + A + ” MAKA ” + B + “”);
    System.out.println(“=======================================”);
    }
    }

  34. import java.io.*;

    public class matematikaDiskrit{

    public static void main(String[] args){

    BufferedReader dataIn = new BufferedReader (new InputStreamReader (System.in));

    String x = “”;

    String y = “”;

    System.out.print(“Masukkan inputan 1 :”);

    try{

    x = dataIn.readLine();

    }catch (IOException e){

    System.out.println(“Eror!”);

    }

    System.out.print(“Masukkan inputan 2 :”);

    try{

    y = dataIn.readLine();

    }catch (IOException e){

    System.out.println(“Eror!”);

    }

    System.out.println(“—-Hasil—-“);

    System.out.println(x + ” DAN ” + y + “”);

    System.out.println(x + ” ATAU ” + y + “”);

    System.out.println(“JIKA ” + x + ” MAKA ” + y + “”);

    System.out.println(x + ” JIKA DAN HANYA JIKA ” + y + “”);

    }

    }

  35. import java.util.Scanner;
    import java.io.*;

    public class TugasLogika {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String input=””;
    try{
    input=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String input2=””;
    try{
    input2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A ^ B : “+input+” DAN “+input2);
    System.out.println(“A v B : “+input+” ATAU “+input2);
    System.out.println(“A → B : JIKA “+input+” MAKA “+input2);
    System.out.println(“A ↔ B : “+input+” JIKA DAN HANYA JIKA “+input2);

    }

    }

    //tampilan
    A= ayah pergi
    B= ibu di rumah

    //hasil
    A ^ B = Ayah pergi dan ibu di rumah
    A v B= Ayah pergi atau ibu di rumah
    A → B = Jika ayah pergi maka ibu ada di rumah
    A ↔ B = Ayah pergi jika dan hanya jika ibu di rumah

    // oleh
    dhanik rishadmanti W.
    09.11.3151

  36. import java.util.Scanner;
    import java.io.*;

    public class TugasLogika {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String input=””;
    try{
    input=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String input2=””;
    try{
    input2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A ^ B : “+input+” DAN “+input2);
    System.out.println(“A v B : “+input+” ATAU “+input2);
    System.out.println(“A → B : JIKA “+input+” MAKA “+input2);
    System.out.println(“A ↔ B : “+input+” JIKA DAN HANYA JIKA “+input2);

    }

    }

    //tampilan
    A= ayah pergi
    B= ibu di rumah

    //hasil
    A ^ B = Ayah pergi dan ibu di rumah
    A v B= Ayah pergi atau ibu di rumah
    A → B = Jika ayah pergi maka ibu ada di rumah
    A ↔ B = Ayah pergi jika dan hanya jika ibu di rumah

  37. //Nama : Hendi Wijayanto
    //NIM : 09.11.3096
    //Kelas : S1 Ti 3H

    #include
    #include
    #include
    void main()
    {
    char p, q,T,F,t,f; //input
    cout<<" Program Proporsitional\n"; //Judul
    cout<<"==========================\n"; //Garis Batas
    cout<>p;endl;
    cout<>q;endl;endl;
    cout<<"\n\nFungsi Conjunction (And)\n";endl; //Deklarasi Fungsi Konjungsi (Dan)
    if(p==T,t&&q==T,t)
    {
    cout<<" (P And Q = T And T) \n bernilai : True";
    }
    else if(p==T,t&&q==F,f)
    {
    cout<<" (P And Q = T And F) \n bernilai : False";
    }
    else if(p==F,f&&q==T,t)
    {
    cout<<" (P And Q = F And T) \n bernilai : False";
    }
    else if(p==F,f&&q==F,f)
    {
    cout<<" (P And Q = F And F) \n bernilai : False";
    }
    cout<<"\n\nFungsi Disjunction (Or)\n";endl; //Deklarasi Fungsi Disjungsi (Atau)
    if(p==T,t&&q==T,t)
    {
    cout<<" (P Or Q = T Or T) \n bernilai : True";
    }
    else if(p==T,t&&q==F,f)
    {
    cout<<" (P Or Q = T Or F) \n bernilai : True";
    }
    else if(p==F,f&&q==T,t)
    {
    cout<<" (P Or Q = F Or T) \n bernilai : True";
    }
    else if(p==F,f&&q==F,f)
    {
    cout<<" (P Or Q = F Or F) \n bernilai : False\n";
    }
    cout<<"\n\nFungsi Conditional (If-Then)\n";endl; //Deklarasi Fungsi Kondisional (Jika Maka)
    if(p==T,t&&q==T,t)
    {
    cout<<" (If P Then Q = If T Then T) \n bernilai : True";
    }
    else if(p==T,t&&q==F,f)
    {
    cout<<" (If P Then Q = If T Then F) \n bernilai : False";
    }
    else if(p==F,f&&q==T,t)
    {
    cout<<" (If P Then Q = If F Then T) \n bernilai : True";
    }
    else if(p==F,f&&q==F,f)
    {
    cout<<" (If P Then Q = If F Then F) \n bernilai : True\n";
    }
    cout<<"\n\nFungsi BiConditional (If and only if)\n";endl; //Deklarasi Fungsi Bikondisional (Jika dan hanya jika)
    if(p==T,t&&q==T,t)
    {
    cout<<" (P If and only if Q = T If and only if T) \n bernilai : True";
    }
    else if(p==T,t&&q==F,f)
    {
    cout<<" (P If and only if Q = T If and only if F) \n bernilai : False";
    }
    else if(p==F,f&&q==T,t)
    {
    cout<<" (P If and only if Q = F If and only if T) \n bernilai : False";
    }
    else if(p==F,f&&q==F,f)
    {
    cout<<" (P If and only if Q = F If and only if F) \n bernilai : True\n";
    }
    cout<<"\n\nFungsi Xor (Exclusive Or)\n";endl; //Deklarasi Fungsi Xor (Eksklusif Or)
    if(p==T,t&&q==T,t)
    {
    cout<<" (P Xor Q = T Xor T) \n bernilai : False";
    }
    else if(p==T,t&&q==F,f)
    {
    cout<<" (P Xor Q = T Xor F) \n bernilai : True";
    }
    else if(p==F,f&&q==T,t)
    {
    cout<<" (P Xor Q = F Xor T) \n bernilai : True";
    }
    else if(p==F,f&&q==F,f)
    {
    cout<<" (P Xor Q = F Xor F) \n bernilai : False\n";
    }
    getch();
    }

    • PERTAMAXXXX gan…Bener Salah Urusan Belakangan…yg Pnting Usaha….(^_^)

    • tambahan Pak, Include pake stdio.h, conio.h, iostream.h… di post malah gag kliatan

  38. /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    /*
    * logika.java
    *
    * Created on 06 Des 10, 14:27:21
    */

    package logika;

    /**
    *
    * @author Iqbal
    */
    public class logika extends javax.swing.JFrame {

    /** Creates new form logika */
    public logika() {
    initComponents();
    }

    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    */
    @SuppressWarnings(“unchecked”)
    //
    private void initComponents() {

    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    text1 = new javax.swing.JTextField();
    text2 = new javax.swing.JTextField();
    okBtn = new javax.swing.JButton();
    textAnd = new javax.swing.JLabel();
    textOr = new javax.swing.JLabel();
    textIfthen = new javax.swing.JLabel();
    textIfOnlyIf = new javax.swing.JLabel();
    jLabel3 = new javax.swing.JLabel();

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    jLabel1.setText(“Masukkan A”);

    jLabel2.setText(“Masukkan B”);

    okBtn.setText(“OK”);
    okBtn.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    okBtnActionPerformed(evt);
    }
    });

    textAnd.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

    textOr.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

    textIfthen.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

    textIfOnlyIf.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));

    jLabel3.setText(“Output”);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(57, 57, 57)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
    .addComponent(textIfOnlyIf, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(textIfthen, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(textOr, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(textAnd, javax.swing.GroupLayout.PREFERRED_SIZE, 324, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGroup(layout.createSequentialGroup()
    .addComponent(jLabel3)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(okBtn))
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addComponent(jLabel2))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
    .addComponent(text1)
    .addComponent(text2, javax.swing.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE))))
    .addContainerGap(19, Short.MAX_VALUE))
    );
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(27, 27, 27)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel1)
    .addComponent(text1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
    .addComponent(jLabel2)
    .addComponent(text2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGap(18, 18, 18)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
    .addComponent(okBtn)
    .addComponent(jLabel3))
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(textAnd, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(textOr, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(textIfthen, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(textIfOnlyIf, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addContainerGap(41, Short.MAX_VALUE))
    );

    pack();
    }//

    private void okBtnActionPerformed(java.awt.event.ActionEvent evt) {

    String varA = text1.getText();
    String varB = text2.getText();

    textAnd.setText(“A^B = “+varA+” dan “+varB);
    textOr.setText(“AvB = “+varA+” atau “+varB);
    textIfthen.setText(“A->B = Jika “+varA+” maka “+varB);
    textIfOnlyIf.setText(“AB = “+varA+” jika dan hanya jika “+varB);
    }

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new logika().setVisible(true);
    }
    });
    }

    // Variables declaration – do not modify
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JButton okBtn;
    private javax.swing.JTextField text1;
    private javax.swing.JTextField text2;
    private javax.swing.JLabel textAnd;
    private javax.swing.JLabel textIfOnlyIf;
    private javax.swing.JLabel textIfthen;
    private javax.swing.JLabel textOr;
    // End of variables declaration

    }
    // Muhammad Iqbal Anugerah Thang (08.11.2380 – 5 H)

    Penjelasan program:
    Ketika tombol OK ditekan maka akan memunculkan hasil yang diinputkan dari kedua textbox, maka pada tombol tersebut diberikan sebuah listing program sbb:

    1. String varA = text1.getText(); merupakan variabel dari string yang diinputkan pada textbox text1

    2. String varB = text2.getText(); merupakan variabel dari string yang diinputkan pada textbox text2

    3. textAnd.setText(“A^B = “+varA+” dan “+varB); menghasilkan output A^B dari variabel A dan B

    4. textOr.setText(“AvB = “+varA+” atau “+varB); menghasilkan output AvB dari variabel A dan B

    5. textIfthen.setText(“A->B = Jika “+varA+” maka “+varB); menghasilkan output A->B dari variabel A dan B

    6. textIfOnlyIf.setText(“AB = “+varA+” jika dan hanya jika “+varB); menghasilkan output AB dari variabel A dan B

  39. package himpunanpernyataan;
    import java.util.Scanner;
    import java.io.*;

    public class HimpunanPernyataan {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” dan”+st2);
    System.out.println(“A \u22c1 B : “+st+” atau “+st2);
    System.out.println(“A \u2192 B : Jika”+st+” maka “+st2);
    System.out.println(“A \u2194 B : “+st+” jika dan hanya jika”+st2);

    }

    }

  40. Nama:Putri Pistikaningtyas
    NIM :09.11.3121

    package himpunanpernyataan;
    import java.util.Scanner;
    import java.io.*;

    public class HimpunanPernyataan {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” DAN “+st2);
    System.out.println(“A \u22c1 B : “+st+” ATAU “+st2);
    System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

    TAMPILAN

    A= adik menangis
    B= ibu belanja

    A ? B : adik menangis DAN ibu belanja
    A ? B : adik menangis ATAU ibu belanja
    A ? B : JIKA adik menangis MAKA ibu belanja
    A ? B : adik menangis JIKA DAN HANYA JIKA ibu belanja

    • Nama:Putri Pistikaningtyas
      NIM :09.11.3121

      package himpunanpernyataan;
      import java.util.Scanner;
      import java.io.*;

      public class HimpunanPernyataan {
      public static void main(String[] args) {

      BufferedReader streamTeks=
      new BufferedReader(
      new InputStreamReader(System.in));

      System.out.print(“A= “);
      String st=””;
      try{
      st=streamTeks.readLine();
      }
      catch (IOException i){
      }

      System.out.print(“B= “);
      String st2=””;
      try{
      st2=streamTeks.readLine();
      }
      catch (IOException i){
      }
      System.out.println(“”);
      System.out.println(“A \u22c0 B : “+st+” DAN “+st2);
      System.out.println(“A \u22c1 B : “+st+” ATAU “+st2);
      System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
      System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

      }

      }

      TAMPILAN

      A= adik menangis
      B= ibu belanja

      A ? B : adik menangis DAN ibu belanja
      A ? B : adik menangis ATAU ibu belanja
      A ? B : JIKA adik menangis MAKA ibu belanja
      A ? B : adik menangis JIKA DAN HANYA JIKA ibu belanja

  41. /*
    * Nama :ERICSSON PS
    * Nim : 09.11.3117
    * Kelas: S1-TI-3H
    */
    package javaapplication2;
    import java.util.Scanner;
    import java.io.*;

    /**
    *
    * @author cah ganteng
    */
    public class eric {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” DAN “+st2);
    System.out.println(“A \u22c1 B : “+st+” ATAU “+st2);
    System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

  42. /*
    * Nama : Tezhar Rayendra Trastaronny P.N
    * Nim : 09.11.3112
    * Kelas: S1.TI.3H
    */
    package javaapplication2;
    import java.util.Scanner;
    import java.io.*;

    /**
    *
    * @author cah ganteng
    */
    public class tezhar {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” DAN “+st2);
    System.out.println(“A \u22c1 B : “+st+” ATAU “+st2);
    System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

  43. /*
    * Nama : Diar Dwi Iskarnadi
    * Nim : 09.11.3135
    * Kelas: S1-TI-3H
    */
    package javaapplication2;
    import java.util.Scanner;
    import java.io.*;

    /**
    *
    * @author cah ganteng
    */
    public class diar {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” DAN “+st2);
    System.out.println(“A \u22c1 B : “+st+” ATAU “+st2);
    System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

  44. /*
    * Nama : Robertus Widi Pracoyo
    * Nim : 09.11.3095
    * Kelas: S1-TI-3H
    */
    package javaapplication2;
    import java.util.Scanner;
    import java.io.*;

    /**
    *
    * @author cah ganteng
    */
    public class robert {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” DAN “+st2);
    System.out.println(“A \u22c1 B : “+st+” ATAU “+st2);
    System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

  45. /*
    * Nama : Ery widiyanto
    * Nim : 09.11.3124
    * Kelas: S1-TI-3H
    */
    package javaapplication2;
    import java.util.Scanner;
    import java.io.*;

    /**
    *
    * @author cah ganteng
    */
    public class ery {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” DAN “+st2);
    System.out.println(“A \u22c1 B : “+st+” ATAU “+st2);
    System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

  46. /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package logika;
    import java.util.Scanner;
    import java.io.*;

    public class LogikaProposisi {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A and B : “+st+” DAN “+st2);
    System.out.println(“A or B : “+st+” ATAU “+st2);
    System.out.println(“A implikasi B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A biimplikasi B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

  47. nama: Pramono
    nim:09.11.3115
    kelas:s1 ti 3h

    package logika;
    import java.util.Scanner;
    import java.io.*;

    public class LogikaProposisi {
    public static void main(String[] args) {

    BufferedReader streamTeks=
    new BufferedReader(
    new InputStreamReader(System.in));

    System.out.print(“A= “);
    String st=””;
    try{
    st=streamTeks.readLine();
    }
    catch (IOException i){
    }

    System.out.print(“B= “);
    String st2=””;
    try{
    st2=streamTeks.readLine();
    }
    catch (IOException i){
    }
    System.out.println(“”);
    System.out.println(“A \u22c0 B : “+st+” DAN “+st2);
    System.out.println(“A \u22c1 B : “+st+” ATAU “+st2);
    System.out.println(“A \u2192 B : JIKA “+st+” MAKA “+st2);
    System.out.println(“A \u2194 B : “+st+” JIKA DAN HANYA JIKA “+st2);

    }

    }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s