hi i have a template program called slide show and i am trying to write the class for this template i have no clue how to start with this can some one help. THANX
here is the code
public class TemplateShow { public static void main(String[] args) {
boolean testResult;
// Create a new slide show with default values. SlideShow slideShow1 = new SlideShow();
// Test showing all the slides one by one. System.out.println("TestDriverA: Expect to see [1] to [10] on 10 lines"); slideShow1.start(); testResult = true; for (int counter = 0; counter < 9; counter++) { if (slideShow1.forward() == false) { testResult = false; } else { showSlide(slideShow1.getCurrent()); } } System.out.println("TestDriverA: Expect: true. Actual: " + testResult );
// Test going past number of slides System.out.println("TestDriverA: try forwarding some more. Should get nothing" ); if (slideShow1.forward() == false) { testResult = false; } else { showSlide(slideShow1.getCurrent()); } System.out.println("TestD riverA: Expect: false. Actual: " + testResult );
// Create a new slide show with 12 elements. SlideShow slideShow2 = new SlideShow(12);
// Test fastForward by showing the first, third, and last elements System.out.println("TestDriverA: Expect to see [1] [3] [12] on 3 lines"); slideShow2.start(); showSlide(slideShow2.getCurrent()); testResult = true; if (slideShow2.fastForward(2) == false) { testResult = false; } else { showSlide(slideShow2.getCurrent()); } if (slideShow2.fastForward(9) == false) { testResult = false; } else { showSlide(slideShow2.getCurrent()); } System.out.println("TestD riverA: Expect: true. Actual: " + testResult );
// Test changing size by changing the first slideShow to have 4 elements slideShow1.setSize(4); System.out.println("TestDriverA: Expect: 4. Actual: " + slideShow1.getSize() );
// Test reverse and fastReverse by showing the the last, next to last, and first elements System.out.println("TestDriverA: Expect to see [4] [3] [1] on 3 lines"); if (slideShow1.fastForward(100) == false) { testResult = false; } else { showSlide(slideShow1.getCurrent()); } if (slideShow1.reverse() == false) { testResult = false; } else { showSlide(slideShow1.getCurrent()); } if (slideShow1.fastReverse(100) == false) { testResult = false; } else { showSlide(slideShow1.getCurrent()); } System.out.println("TestD riverA: Expect: true. Actual: " + testResult );
// Test going past the first slide and going forwards a negative amount System.out.println("TestDriverA: try reversinging some more. Should get nothing" ); if (slideShow1.fastReverse(100) == false) { testResult = false; } else { showSlide(slideShow1.getCurrent()); } System.out.println("TestD riverA: Expect: false. Actual: " + testResult );
// Attempt to reset the first slide show to 10 elements slideShow1.setSize(10); System.out.println("TestDriverA: Expect: 4. Actual: " + slideShow1.getSize() );
// Attempt to reset the first slide show to 0 elements slideShow1.setSize(0); System.out.println("TestDriverA: Expect: 4. Actual: " + slideShow1.getSize() );
// Show the last element System.out.println("TestDriverA: Expect to see [4] on the next line");
// Attempt to create a new slide show with 0 elements. SlideShow slideShow3 = new SlideShow(0); System.out.println("TestDriverA: Expect: 10. Actual: " + slideShow3.getSize() );
i am trying to read the above pprogram this is the class and i need some help building this class in order to run the above program thanx
SlideShow public SlideShow() { Creates a new SlideShow object with 10 slides and sets the index to the current slide to 1 } //SlideShow public SlideShow(int size) {
}
//forward
public boolean forward() { this sould fast forward }
//fastforward
public booleanfastForward(int jump) {
}
//reverse
public boolean reverse() {
} //fastReverse
public boolean fastReverse(int jump) {
}
//start
public void start() { System.out.println("TestDriverA: Expect to see [1] to [10] on 10 lines"); slideShow1.start(); testResult = true; for (int counter = 0; counter < 9; counter++) { if (slideShow1.forward() == false) { testResult = false; } else { showSlide(slideShow1.getCurrent()); } } System.out.println("TestDriverA: Expect: true. Actual: " + testResult );