Question: PLEASE Help code in Java! CS475 Computation Theory Topic 5 Assignment This assignment focuses on conjunctive normal form formulas (cnf-formula) and satisfiability. In this assignment,
PLEASE Help code in Java!


CS475 Computation Theory Topic 5 Assignment This assignment focuses on conjunctive normal form formulas (cnf-formula) and satisfiability. In this assignment, you must create a Netbeans Java program that: - prompts the user for the location of a file to load a cnf-formula (use JFileChooser) - reads a cnf-formula from the file creating a CnfFormula object (see file-format below), - prompt the user for a variable assignment (see AssignmentView below), - verifies and displays whether the user's assignment satisfies the cnf-formula, - determines whether the cnf-formula is satisfiable and if so, output the assignment, - as Java comments give the Big-O analysis of the verify and isSatisfiable methods, - as a separate file, submit the cnf-formula file you "unit" tested on. Input File Format Consider the cnf-formula, (x1x3x4)(x1x3)(x1x4x2)x3(x2x4) This cnf-formula is represented as one line in the input file, The general format of this cnf-formula in the input file is: clause1clause2clausen Where each clause in the cnf-formula is separated by a caret character. A clause is either a literal or a disjunction of literals surrounded by where a letter ' v ' is used to separate multiple literals. literal 1v literal 2vv literal n A literal is either a variable name or a negated variable, in which case the variable name is preceded by the letter ' n ' (Naturally, n 's and v 's cannot be used in a variable name.) Class Diagram Minimally, your program must implement the following UML class diagram (notes follow). CnfFormula and Clause - literals() - return the variable names (i.e. literals) used in this formula/clause - verify(Assignment) - return true, if the truth assignments for the variables in the Assignment satisfy this formula/clause (c) Regis University, All Rights Reserved CS475 Computation Theory Topic 5 Assignment SatNpApp - verify(Assignment) - utility method that sends a verify message to a CnfFormula - isSatisfied() - utility method that finds an assignment, if any, that satisfies the current CnfFormula Here's one way to implement the main(...) method in the SatNpApp: view = new AssignmentView(); File file = chooseExprlocation(); try \{ Cnfformula formula = loadCnfFormula (file); do \{ Assignment assignment = new Assignment (formula); view.setmodel(assignment); view.setvisible(true); if (expr.verify(assignment)) \{ JoptionPane.showMessagedialog(null, "Satisfied"); \} else f JoptionPane.showMessagedialog(null, "Not Satisfied"); isSatisfiable (formula); \} while (trueFalsePrompt ("Test another input string?"))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
