Computer Science Canada E=Mc2 Program |
Author: | evogre3n [ Sun Apr 17, 2005 9:00 am ] | ||
Post subject: | E=Mc2 Program | ||
Hey everyone. This is the most recent assignement ivehad. Im just a begginer, starting out in turing.. and the assignment was on if structures and error traps etc. Here is the code. Check it out, give some feedback thanks a lot ![]()
|
Author: | Delos [ Sun Apr 17, 2005 9:51 am ] |
Post subject: | |
This is interesting...you realize that by importing GUI, you're slowing your start up significantly. You only ever use GUI. commands once, and that's to set the GUI background colour... You seeing the problem here? Error trapping: you *really* need to work on this. All of the old favourites work. Input string where integers are asked for, excessive string length, Ctrl+Z...time to start trapping... Now that you've pretty much got the hang of linear programming, it's time you moved onto something a little more object-oriented. No classes or pointers for you just yet...just spend some time looking at the Tutorials on Procedures, Functions, and Modules. |
Author: | evogre3n [ Sun Apr 17, 2005 1:29 pm ] | ||||
Post subject: | |||||
Im looking into everything you have mentioned The thing is, i asked my teacher, she says she doesnt want me using any of that, no procedures or anything, im not even allowed to use the "loop" command.. :S THanks for the comments Btw. does anyone know what this error could mean? this line
this error:
|
Author: | Cervantes [ Sun Apr 17, 2005 1:56 pm ] | ||
Post subject: | |||
It means your numbers are too big. Use real numbers. Also, you got the equations wrong. First, the speed of light is 3e5, and we want to square that. So that's (3 x 10^5)^2. That is not the same as 3*10^8. Rather, it's the same as 9 x 10^10. So let's just use that number instead of doing these calculations over and over. The second thing is that, I think, you've mixed up the equations. You've got m = ec^2. It should be this: e = mc^2 m = e/c^2 So the code looks like this:
|
Author: | Andy [ Sun Apr 17, 2005 4:16 pm ] |
Post subject: | |
this program isnt all that useful... if you however added calculations for wavelengths of matters, or momentum of photons wit electron problems, then it would be better. also, mass starts off with negative energy, because the strong nulcear force binds the matter together and a certain amount of energy has to be provided inorder to liberate the nucleons |
Author: | Delos [ Sun Apr 17, 2005 5:33 pm ] |
Post subject: | |
Hehe, quite true Andy...[memories of grade 12 physics rush back in]... Ouch. That hurt. |
Author: | evogre3n [ Tue Apr 19, 2005 8:37 am ] |
Post subject: | |
if your ramblin on about the usefullness of the program, you obviously missed the point. The point of this was to have me learn about if structures etc. ![]() |
Author: | jamonathin [ Tue Apr 19, 2005 11:30 am ] |
Post subject: | |
So you made this program so you could learn about if's, and your program's not that useful, so why did you submit it then, if you didn't want people to criticize it? To show off that you know how to use 'if' statements? ![]() |
Author: | Catalyst [ Tue Apr 19, 2005 9:46 pm ] |
Post subject: | |
the speed of light is 3e5 km/s but in this eq you should use 3e8 m/s |
Author: | hacker101 [ Fri May 06, 2005 8:57 pm ] |
Post subject: | |
Nick: Ms. **** would be proud. Nice program. Mine was i=q/t |
Author: | Andy [ Sun May 08, 2005 4:43 pm ] |
Post subject: | |
ever heard of pm? |