The Artima Developer Community
Sponsored Link

Java Answers Forum
help i need to create the class

1 reply on 1 page. Most recent reply: Nov 12, 2002 10:34 PM by hyderman

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
hyderman

Posts: 11
Nickname: salem99
Registered: Oct, 2002

help i need to create the class Posted: Nov 9, 2002 9:29 PM
Reply to this message Reply
Advertisement
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 );

testResult = true;
if (slideShow1.fastForward(-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");

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


hyderman

Posts: 11
Nickname: salem99
Registered: Oct, 2002

Re: help i need to create the class Posted: Nov 12, 2002 10:34 PM
Reply to this message Reply
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 );


}
//setSize

public void setSize(int size)
{

}

//getSize

public int getSize()
{

}

//getCurrent

public int getCurrent()
{

}

Flat View: This topic has 1 reply on 1 page
Topic: Recursive method to find minimum value in an array Previous Topic   Next Topic Topic: It's a Brand New Formatting Algorithm

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use