PDA

View Full Version : Is there anyway to hadle the exceptions??


keka
04-09-2008, 03:32 PM
One of my students, in their project, asking the user to enter an integer. But when the user enters a String, the program terminates saying that there is a bug. Is there any way to catch this exception or typecasting the arguments??

Thanks
________
HONDA INTEGRA SPECIFICATIONS (http://www.honda-wiki.org/wiki/Honda_Integra)
________
The hertz corporation (http://www.ford-wiki.com/wiki/The_Hertz_Corporation)

lanceA
04-09-2008, 07:33 PM
Yes there is an answer - check out Dick Baldwin's example of how to do this:
http://www.dickbaldwin.com/alice/Alice0930.htm#Multiplication_game

It's an excellent tutorial and can be expanded to Addition, Subtraction, etc. I used it this year and my students had GREAT results and really had fun programming the various routines!

Good luck,

lanceA
04-11-2008, 07:57 PM
My 9th graders are just beginning to submit their Alice Projects. This is the first one I received this year. I thought that I would share it with you. (You will need a fast machine with a lot of RAM.)

All music recordings remain within the 30 sec. acceptable limit.

Enjoy - I am impressed.

DickBaldwin
04-11-2008, 09:17 PM
Very good!

A YouTube video would be nice to make it easier for others to view.

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm

lanceA
04-11-2008, 09:27 PM
I encourage my students not to watch beatings, stupid kids, etc on the Internet.

But, thanks Dick

DickBaldwin
04-12-2008, 09:06 AM
I encourage my students not to watch beatings, stupid kids, etc on the Internet.

But, thanks Dick

There is good material as well as bad material on YouTube. See, for example, the video at the following URL:

http://www.youtube.com/watch?v=ji5_MqicxSo

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm

lanceA
04-12-2008, 06:41 PM
I don't disagree with you about good and not-so-good material on YouTube, Dick. However after teaching a short course on Ethics and Tecnology to high schoolers, I still prefer they not join Social Networking sites such as YouTube, FaceBook, etc.

However I have pre-ordered The Last Lecture (http://www.amazon.com/Last-Lecture-Randy-Pausch/dp/1401323251/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1208043268&sr=8-1) from Amazon.com. :)

Thanks for your input.

DrJim
04-13-2008, 06:04 PM
You will need a fast machine with a lot of RAM.

After being unable to get War Zone to run, I was pleasantly surprised that Ajax ran OK even on my slowest machine and with a couple of other programs running in the background. The only problem was a bit of a delay before a sound would play (occasionally causing distortion) - but that's always a problem with Alice on the slow machine and with multiple programs running.

I suspect that the reason it worked so well is the very ordered structure of the program with many "do in order" methods instead of multiple threads running at the same time. Do you have any thoughts/experience on this one way or the other?

lanceA
04-13-2008, 08:54 PM
It's been my experience that the sound distortion in Alice is caused by the program having to access the harddisk constantly to read the sound file and quiet possibly the memory buffer is somehow being set to only read in small segments at a time - I could be TOTALLY offbase here!!

I'm glad you were successful in running the program. Before a student begins programming a major assignment they are required to submit a detailed specification basically outlining the algorithms to be used in the program, i.e., don't just start 'banging on the keyboard'! - give your program some thought. Then after discussion/refinement the student is given the go-ahead to develop their animation. You would be surprised how many programs I receive that suffer from 'code-bloat' - unused code remains in the program which consumes memory upon loading and thereby slowing the program down. I need to constantly remind them to remove 'unused code'.

Anyway, I'm glad you were able to run AJAX - get ready for more Projects in the next few weeks, although I can not guarantee they will all run smoothly. After all, we are dealing with 'the next generation of Computer Scientists'. :rolleyes:

(At the 9th Grade level)

But at least we have attracted their attention!

DickBaldwin
04-13-2008, 10:12 PM
... But at least we have attracted their attention!

Best academic news I've had in quite a while.

Dick Baldwin
Free Alice tutorials: http://www.dickbaldwin.com/tocalice.htm
Free programming tutorials: http://www.dickbaldwin.com/toc.htm

DrJim
04-14-2008, 12:01 PM
In this particular case, the sound distortion problem I was referring to just refers to the fact that once a sound starts, it plays through to the end. Thus, since the delay from the command execution to the actual sound start can be variable (on my slower machine with other demands on the system, at least) the speakers occasionally overlapped.

For an example, see the attached. Warning - the program name was chosen for a reason. :) Note, by the way, that it was initially a huge (23+M) file (had to cut some music to make the file size reasonable for the forum) but, for single songs, it still played fine.

Speaking of excess code (which doesn't surprise me a bit) - to actually delete the music files, I had to save the program under a different name. Just dragging the sound to the trash can and resaving under the same name didn't change the file size.