# Test Driven Development Lab Assignment For each of the following i...

## Question

Test Driven Development Lab Assignment
For each of the following iterations, write just enough code to pass the test while meeting the principles of TDD. Include the code for each iteration and indicate if it 1) compiles and 2) passes the test

Iteration 1 - Example
MyNumber n = new MyNumber();
}

//You include this after every iteration.
import static org.junit.Assert.*;
import junit.framework.TestCase;
import org.junit.*;

public class MyNumber extends TestCase {
}
COMPILES AND PASSES (You include this after every iteration.)

Iteration 2
MyNumber n = new MyNumber();
n.setValue(7);
assertEquals(0, n.isPrime());
}

Iteration 3
MyNumber n = new MyNumber();
n.setValue(7);
assertEquals(0, n.isPrime());
n.setValue(10);
assertEquals(-1, n.isPrime());
}

Iteration 4
MyNumber n = new MyNumber();
n.setValue(7);
assertEquals(0, n.isPrime());
n.setValue(10);
assertEquals(-1, n.isPrime());
assertEquals(“10 is not Prime”, n.printPrime());
}

Iteration 5
public void testEvenNumber (){
MyNumber n = new MyNumber();
n.setValue(3);
assertEquals(-1, n.isEven());
n.setValue(2);
assertEquals(0, n.isEven());
assertEquals(“2 is Even”, n.printEven());
}

Final Step
Write a JUnit test case for printing the factors of a number, and then write the code to pass the test.

## Solution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

//You include this after every iteration.
import static org.junit.Assert.*;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.junit.*;

public class MyNumber extends TestCase {

private int value;

public MyNumber() {
value = 1;
}

public void testFactorNumber() {
MyNumber n = new MyNumber();
n.setValue...

By purchasing this solution you'll be able to access the following files:
Solution.docx and Solution.zip.

\$40.00
for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

### Find A Tutor

View available Computer Science - Other Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.