The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
This programming project involves writing a program to calculate the terms of the following sequence of numbers: 0 1 2 5 12 29 ... where each term of the sequence is twice the previous term plus the second previous term. The 0th term of the sequence is 0 and the 1st term of the sequence is 1.
Â
1Project 3This programming project involves writing a program to calculate the terms of the following sequence ofnumbers: 0 1 2 5 12 29 ... where each term of the sequence is twice the previous term plus the secondprevious term. The 0thterm of the sequence is 0 and the 1stterm of the sequence is 1.For example:0 1 2 -> (0 + 1 + 2) + 2 = 50 1 2 5 -> (0 + 1 + 2 + 5) + 5 = 120 1 2 5 12 -> (0 + 1 + 2 + 5 + 12) + 12 = 29…The interface to the program should be a 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 tocompute the term of the sequence. When the user enters a value fornand then clicks theComputebutton,thenthterm of the sequence should be displayed in theResultfield. TheEfficiencyfield should contain thenumber of calls to the recursive method when the recursive option is chosen and the number of iterationsof the loop when the iterative option is selected.TheIterativeradio button should be initially set to selected.When the window is closed, the efficiency values should be computed with values ofnfrom 0 to 10 andwritten to a file. Each line of the file should contain the value ofn, the efficiency of the iterative methodfor that value ofnand the efficiency of the recursive method. The values should be separated by commasso the file can be opened with Excel and used to graph the value of the efficiencies for both the iterativeand recursive options along theyaxis with the value ofnalong thex-axis. The graph should be includedin the Word document that accompanies this project and should also contain a brief explanation of theobserved results.The program should consist of two classes.1.The first class should define the GUI. In addition to the main method and a constructor to buildthe GUI, an event handler will be needed to handle theComputebutton click and another handlerwill be needed to produce the file described above when the window is closed. The latter handlershould be an object of an inner class that extends the WindowAdapter class.