[Solved] CMIS 242 – Project 3

30 $

File Name: CMIS_242_–_Project_3.zip
File Size: 207.24 KB

SKU: [Solved] CMIS 242 – Project 3 Category: Tag:

Or Upload Your Assignment Here:


1. SpecificationThe third programming project involves writing a program to calculate the terms of the following sequence ofnumbers: 0 1 3 8 21 55 144 377 … where each term is three times the previous term minus the second previousterm. The 0th term of the sequence is 0 and the 1st term of the sequence is 1.The example below shows how to calculate the next sequence term:Current sequence: 0 1 Calculate next term: 3 * 1 – 0 = 3Current sequence: 0 1 3 Calculate next term: 3 * 3 – 1 = 8Current sequence: 0 1 3 8 Calculate next term: 3 * 8 – 3 = 21Current sequence: 0 1 3 8 21 Calculate next term: 3 * 21 – 8 = 55… etc.The interface to the program should be a Swing based GUI that looks similar to the following:The pair of radio buttons allows the user to choose whether an iterative or recursive method is used to computethe term of the sequence (the Iterative radio button should be initially selected). When the user enters a valuefor n and then clicks the Compute button, the nth term of the sequence (counting from zero) should be displayedin the Result field. The Efficiency field should contain the number of calls to the recursive method when therecursive option is chosen and the number of iterations of the loop when the iterative option is selected. Theprogram will check the validity of the user input value which should be a positive integer. A message will beshown in a JOptionPane for illegal entered values.When the window is closed, the efficiency values should be computed with values of n from 0 to 15 and written toa text file outData.txt. Each line of the file should contain the value of n, the efficiency of the iterative method forthat value of n and the efficiency of the recursive method. The values should be separated by commas so the filecan be opened with Excel and used to graph the value of the efficiencies for both the iterative and recursiveoptions along the y axis and with the value of n along the x-axis. The graph should be included in the solutiondescription document that accompanies this project and should also contain a brief explanation of the observedresults.The program should consist of two classes: P3GUI and Sequence.21. Class P3GUI should define the Swing based GUI and should be hand-coded and not generated by a GUIgenerator. In addition to the main method and a constructor to build the GUI, an event handler will be needed tohandle the Compute button click and another handler will be needed to produce the file described above whenthe window is closed. The latter handler should be an object of an inner class that extends the WindowAdapterclass.2. Class Sequence should be a utility class meaning that all its methods must be class (static) methods and noobjects should be able to be generated for that class. It should contain three public methods:a. The first method computeIterative should accept a value of n and return the corresponding element inthe sequence using iteration.b. The second method computeRecursive should accept a value of n and return the corresponding elementin the sequence using recursion. This method will initialize the efficiency counter before calling the privaterecursive method that will actually perform the recursive computation.c. The third method getEfficiency will return the efficiency counter left behind by the previous call to eitherof the above two methods.Your program should compile without errors.The Google recommended Java style guide (https://google.github.io/styleguide/javaguide.html) should be used toformat and document your code. Specifically, the following style guide attributes should be addressed: Header comments include filename, author, date and brief purpose of the program. In-line comments used to describe major functionality of the code. Meaningful variable names and prompts applied. Class names are written in UpperCamelCase. Variable names are written in lowerCamelCase. Constant names are in written in All Capitals. Braces use K&R style.In addition the following design constraints should be followed: Declare all instance variables private Avoid the duplication of codeTest cases should be supplied in the form of a table with columns indicating what aspect is tested, the inputvalues, expected output, actual output and if the test case passed or failed. This table should contain 5 columnswith appropriate labels and a row for each test case. Note that the actual output should be the actual results youreceive when running your program and applying the input for the test record. Be sure to select enough differentkinds of employees and situations to completely test the program.2. Submission RequirementsSubmit the following to the Project 3 assignment area no later than the due date listed in your LEO classroom.1. Source files P3GUI.java, Sequence.java and the program generated output file outData.txt. The source codeshould use Java code conventions and appropriate code layout (white space management and indents) andcomments. All submitted files may be included in a .zip file.32. The solution description document P3SolutionDescription (.pdf or .doc / .docx) containing the following:(1) Assumptions, main design decisions, error handling;(2) Test cases table(3) The graph of the value of the efficiencies for both the iterative and recursive options along with a briefexplanation of the observed results.(4) Screen captures showing successful program compilation and test cases execution. Each screen capture shouldbe properly labeled, clearly indicated what the screen capture represents.(5) Lessons learned from the project;3. Grading RubricThe following grading rubric will be used to determine your grade:Attribute Meets Does not meetP3GUI class 40 pointsa) Defines the GUI.b) Contains a pair of radio buttonsallowing the user to choose whether aniterative or recursive method is used tocompute the term of the sequence.c) Allows the user to enter a value for nand click the Compute button, todisplay the nth term of the sequence inthe Result field.d) User input value is checked andwarning message is displayed if theentered value is not a positive integer.e) Allows the Efficiency field to containthe number of calls to the recursivemethod when the recursive option ischosen and the number of iterations ofthe loop when the iterative option isselected.f) The Iterative radio button is initiallyset to selected.g) When the window is closed, theefficiency values computes with valuesof n from 0 to 15 and writes them to afile.h) Each line of the output file containsthe value of n, the efficiency of theiterative method for that value of n and0 pointsa) Does not define the GUI.b) Does not contain a pair of radio buttonsallowing the user to choose whether aniterative or recursive method is used tocompute the term of the sequence.c) Does not allows the user to enter avalue for n and click the Compute button,to display the nth term of the sequence inthe Result field.d) User input value is checked and warningmessage is displayed if the entered valueis not a positive integer.e) Does not allow the Efficiency field tocontain the number of calls to therecursive method when the recursiveoption is chosen and the number ofiterations of the loop when the iterativeoption is selected.f) The Iterative radio button is not initiallyset to selected.g) When the window is closed, theefficiency values does not compute withvalues of n from 0 to 15 and the outputfile is not generated.h) Each line of the output file does notcontain the value of n, the efficiency of4the efficiency of the recursive method.i) The values of the output file areseparated by commas so the file can beopened with Excel.j) Provides an event handler to handlethe Compute button click and anotherhandler will be needed to produce thefile described above when the windowis closed. The latter handler is an objectof an inner class that extends theWindowAdapter class.the iterative method for that value of nand the efficiency of the recursivemethod.i) The values of the output file are notseparated by commas so that the file canbe opened by Excel.j) Does not provides an event handler tohandle the Compute button click andanother handler will be needed toproduce the file described above whenthe window is closed. The latter handler isan object of an inner class that extendsthe WindowAdapter class.Sequence class 30 pointsa) All methods are class (static)methods.b) Contains three public methods.c) Contains computeIterative methodthat accepts a value of n and returnsthe corresponding element in thesequence using iteration.d) Contains method computeRecursivethat accepts a value of n and returnsthe corresponding element in thesequence using recursion.e) The computeRecurvise method willinitialize the efficiency counter beforecalling the private recursive methodthat will actually perform the recursivecomputation.f) The getEfficiency method returns theefficiency counter left behind by theprevious call to either of the above twomethods.0 pointsa) All methods are not class (static)methods.b) Does not contain three public methods.c) Does not contain the computeIterativemethod that accepts a value of n andreturns the corresponding element in thesequence using iteration.d) Does not contain the computeRecursivemethod that accepts a value of n andreturns the corresponding element in thesequence using recursion.e) The computeRecurvise method doesnot initialize the efficiency counter beforecalling the private recursive method thatwill actually perform the recursivecomputation.f) The getEfficiency method does notreturn the efficiency counter left behindby the previous call to either of the abovetwo methods.Test Cases 10 pointsa) Test cases are supplied in the formof table with columns indicating testcase objective, the input values,expected output, actual output and ifthe test case passed or failed.0 pointsa) No test cases were provided.5b) Enough scenarios selected tocompletely test the program.c) Test cases were included in thesupporting word or PDFdocumentation.Documentation and Styleguide20 pointsa) Solution description documentP3SolutionDescription includes all therequired sections appropriate titled.b) Solution description documentP3SolutionDescription includes projectspecific, meaningful information.Source code criteriac) Header comments include filename,author, date and brief purpose of theprogram.d) In-line comments used to describemajor functionality of the code.e) Meaningful variable names andprompts applied.f) Class names are written inUpperCamelCase.g) Variable names are written inlowerCamelCase.h) Constant names are in written in AllCapitals.i) Braces use K&R style.i) Declare all instance variables private.k) Avoids the duplication of code.0 pointsa) No solution description document isincluded.Source code criteriab) Java style guide was not used toprepare the Java code.c) All instance variables not declaredprivate.d) Duplication of code was not avoided.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CMIS 242 – Project 3
30 $