aspose file tools*
The moose likes Java in General and the fly likes can't run this program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "can Watch "can New topic
Author

can't run this program

salem salman
Greenhorn

Joined: Oct 08, 2002
Posts: 9
i am trying to run this program testDriverA . the problem is that the class is missing some of the methods.
The main program TesDriverA is fine but the class is giving me trouble. please can some one help here.
thanx

The class:

public class SlideShow
{
int slideCounter
}
public SlideShow()
{
// set initial default values for all of your instance variables
slideCounter = 10;
startMyIndex = 1;
}
public void start()
{
startMyIndex = 1;
}
public int getSize()
{
return slideCounter;
}
public int getCurrent()
{
return startMyIndex;
}
public SlideShow(int size)
{
//missing this code
}
public boolean fastForward(int jump)
{
// also missing this code
}
----------------
HERE IS THE MAIN PROGRAM:
public class TesDriverA
{
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("TestDriverA: 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("TestDriverA: 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("TestDriverA: 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("TestDriverA: Expect: false. Actual: " + testResult );
testResult = true;
if (slideShow1.fastForward(-100) == false)
{
testResult = false;
}
else
{
showSlide(slideShow1.getCurrent());
}
System.out.println("TestDriverA: 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");
if (slideShow1.fastForward(100) == false)
{
testResult = false;
}
else
{
showSlide(slideShow1.getCurrent());
}
// Attempt to create a new slide show with 0 elements.
SlideShow slideShow3 = new SlideShow(0);
System.out.println("TestDriverA: Expect: 10. Actual: " + slideShow3.getSize() );
} // end main
private static void showSlide(int slideNumber)
{
System.out.println("[ "+ slideNumber + " ]");
}
}//end class
[ November 18, 2002: Message edited by: salem salman ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Do us a favor and edit that thing to make it easy to read. So, perhaps add some indentation.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: can't run this program