Solved

Help Prop Logic and GUI creation

Posted on 2003-11-18
5
275 Views
Last Modified: 2006-11-17
I need to create an application with a GUI that will allow me to enter a term of Propositional Logic and view the truth table for that term.  Once the term is entered, you can either request the term to be displayed with brackets where necessary, or request the truth table for that term to be shown. The application should give an error-message if the term that has been entered is not well-formed; if the term is well-formed, then the application should present either the term with brackets only where necessary, or the truth table for that term, depending on the request made.

For example, if the user enters the term:


    (a or c) implies a and b


and requests the truth table to be shown, then your application should present (something like):

    a c b | a or c implies a and b
    ----------------------------
    T T T |            T
    F T T |            F
    T F T |            T
    F F T |            T
    T T F |            F
    F T F |            F
    T F F |            F
    F F F |            T


The GUI that should implement the Model-View-Controller.
0
Comment
Question by:withtheskills
  • 2
5 Comments
 
LVL 15

Expert Comment

by:jimmack
ID: 9770172
We can't do your homework for you.  When you've made a start and you have problems, come back and ask specific questions.
0
 

Author Comment

by:withtheskills
ID: 9777357
Sorry I just need some advice on where to start
0
 
LVL 15

Accepted Solution

by:
jimmack earned 125 total points
ID: 9777384
How much do you need?  It's difficult to assess whether you have a good understanding of Java (and Swing) or not.  Since you mention MVC, this implies that you're looking for a GUI solution.

Start with a JOptionPane.showInputDialog() to get the input from the user.  There are several different versions of this method, so you'll need to decide which one to use depending on how much information you want to supply to it.

For the display of the truth table, I would probably use something like a GridLayout inside a JPanel, added to the center of a JFrame.  The GridLayout having the appropriate number of rows and columns for the table you are going to display.  If the table could be very long, add the JPanel to a JScrollPane.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now