Tape for a Turing Machine (Doubly-linked List) Short exercise in which you will code part of an existing project. In this case, you will be working with a doubly-linked list. To make this topic more interesting, the list that you work on will be part of a Turing Machine. A Turing Machine is a kind of very simple, abstract computing device that was introduced in the 1930's by Alan Turing as a way of studying computation and its limitations. The classes that you need for the lab are in a package named turing. You will define a new class named Tape in this package. You can find the Java source in the code directory. You should copy this directory into an Eclipse project. There will be errors, since the existing classes depend on the Tape class, which you have not yet written. Don't forget the Javadoc comments. A Class for Turing Machine Tapes A Turing machine works on a "tape" that is used for both input and output. The tape is made up of little squares called cell
Create a directory called “TestClassValue” Hereafter, we call this directory <dir>. Create a Java class com.work.sample.FlawedClass in directory <dir>/src. (The actual path will obviously reflect the package structure.) 100% Branch Coverage & 100% Statement Coverage Add to the class a method called flawedMethodl that contains a division by zero fault such that it is possible to create a test suite that achieves 100% branch coverage and does not reveal the fault every test suite that achieves 100% statement coverage reveals the fault. Conversely, if you were able to create the method, then create two JUnit test classes com.work.sample.FlawedClassTestBCl and com.work.sample.FlawedClassTestSCl for class FlawedClass as follows: FlawedClassTestBCl should achieve 100% branch coverage of flawedMethodl and not reveal the fault therein. FlawedClassTestSCl should achieve 100% statement coverage of flawedMethodl and reveal the fault therein. Both classes should be
Report The Bug From The Following Source Code: import java.util.Arrays; /** * This class looks like it's meant to provide a few public static methods for * searching and sorting arrays. It also has a main method that tests the * searching and sorting methods. * * TODO: The search and sort methods in this class contain bugs that can cause * incorrect output or infinite loops. Use the Eclipse debugger to find the bugs * and fix them */ public class BuggySearchAndSort { public static void main(String[] args) { int[] A = new int[10]; // Create an array and fill it with random ints. for (int i = 0; i < 10; i++) { A[i] = 1 + (int) (10 * Math.random()); } int[] B = A.clone(); // Make copies of the array. int[] C = A.clone(); int[] D = A.clone(); System.out.print("The array is:"); printArray(A); if (contains(A, 5)) { System.out.println("This array DOES contain 5."); } else { System.out.println("This array DOES NOT contain 5."
Comments
Post a Comment