zero cool

zero cool

  • NA
  • 9
  • 7.2k

Need C# help with a program creation

Sep 16 2012 6:47 PM
Hello

I need help with a c# program creation... The PDF FILE ATTACHED EXPLAINS IT ALL

I have to write a graphics program that depicts that trajectory of a cannon being fired off from the top of a cliff. The canon is at 10,10. The ground at the bottom of the cliff is the line y=200.

Your program will consist of a form named CanonForm that has a "speed" textbox and a "fire" button, together with a threaded FireWorker that is made in response to th epressing the fire button. The FireWorker is responsible for drawing the cannonball trajectory over time.

When the fire button is pressed, in its click callback you will determine the value of the number entered in the speed textbox, as a double value, using the Double.parse method. For example, if the textbox is named  SpeedTextbox, you can get the floating point value theuser typed into it via:

speed = Double.parse(SpeedTextbox.Text);

Having determined the speed specified, you will make an instance of your FireWorker class, bind it to a Thread, start the Tread and wait for it to become alive. All this happens in the click callback of the fire button.

The Fireworker will be given a CanonForm when it is instantiated, and will hold on to this CanonForm inside itself, as a data member. Inside the Fireworker's run() method, it will periodically call the CanonForm's drawcannonball() method. The pseudocode for the CanonForm's drawcannonball method looks like this: The PDF FILE ATTACHED EXPLAINS IT ALL



Attachment: pdf inside zipped.zip

Answers (1)