Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 848
  • Last Modified:

Java GUI to show Boolean Truth Tables

I am a java novice and am trying to prove my worth to my so-called Java 'expert' friends. As a result of this i stupidly took up a bet with one of these friends. The bet was that i would not be able to create a java application that consists of a GUI that will enable a user to enter a Boolean term and the the application will then display a truth table for the that term. To prove that i could do this is told my friend that this would be easy. This was another studip mistake as he then added more stuff to it. The application should also be able to clear any previously entered terms and give the user the option to be able to request that the term be displayed with or without the appropriate brackets. The application should also be able to report an informative error-message if the term that has been entered is not well-formed.

To be total honest i have bitten off more than i can chew here. i do not know where to begin and have no chance off winning this bet. As a result i have know code to show you.

If i can pull it off i will be shown more respect and become more excepted into the circle of 'experts'. No one will help me as they all know about the bet and do not want to get involved.

i know that this question has a background that may be a bit out of the ordinary but any help that can be provided would be greatly appreciated.

Thanks,

garyjohno

ps. i know that this is alot to ask for only 65 points but it is all that i have available. Please help!
0
garyjohno
Asked:
garyjohno
  • 4
1 Solution
 
CEHJCommented:
See previous question asked - it might parse logical expressions too
0
 
garyjohnoAuthor Commented:
CEHJ your advice was not very good at all.<part of the comment removed from AnnieMod as insult to another member> have u seen how many solved questions there are. there is no way im searchin g through all of those.

can someone else please help me with this.
0
 
garyjohnoAuthor Commented:

AnnieMod,

I am sorry for using such language. I was frustrated. Sorry and it will not happen in the future.

garyjohno
0
 
garyjohnoAuthor Commented:
AnnieMod,

yes wel dun. u r on to me cu lata alligator :)

0
 
garyjohnoAuthor Commented:
only playing with u AnnieMod,

the other question like mine is from a friend of mine. he has taken up the bet 2. the reason he has posted it is because he had more available points than me and he also knows about truth tables, hence the diagram in his question.

i wud not expect an expert to do my homework for me because i have tried that before and was told what you are telling me now. That was before i had read through the EE rules, sorry. I can understand why you are suspicious. This IS a genuine bet and i do need genuine help to win it.

This is the code that i have so far:

import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;

class FirstFrame extends JFrame
{
    FirstFrame()
    {
        super("Truth Table Constructor");
       
        buildGUI();

        setDefaultCloseOperation(EXIT_ON_CLOSE);
        pack();
        setVisible(true);
    }
   
    private void buildGUI() {
        JPanel top = new JPanel();
        top.setLayout(new BorderLayout());
        top.add(new JTextField(25), BorderLayout.CENTER);
        top.add(new JButton("OK"), BorderLayout.EAST);
       
        top.setBorder(new TitledBorder(new EtchedBorder(), "Enter a Statement"));
       
        add(new JButton("Quit"), BorderLayout.SOUTH);
    }
   
    public static void main(String[] args)
    {
        FirstFrame f = new FirstFrame();
    }
}

This code will not execute correctly. Any help will be appreciated

garyjohno
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now