TI 89 program missing a parenthesis

In summary, the conversation discusses a program to find the midpoint and distance, but the program is not functioning correctly. The speaker offers suggestions to fix the issue, such as making the variables local and ensuring the program name and "Prgm" are included. They also suggest improving the program's structure for better readability and functionality.
  • #1
breebreebran
12
0
I'm trying to write a program to find midpoint and distance.
And here's what I have.

Code:
Prompt dist
If dist=1 then
Prompt x,y,x2,y2
√((x2-x)^2+(y2-y)^2)→d
Disp d
Else
Prompt xx1,xx2,yy1,yy2
(xx1+xx2)/2→a
(yy1+yy2)/2→b
Disp a,b
Endif
Endprgm


When I try to run this program it says I am missing a parenthesis somewhere.
And I had modified the code before. I don't remember how. But when I did that it said that the variable was already reserved or something like that.
 
Computer science news on Phys.org
  • #3
First thing: unless you need the variables that aren't standard like x or y outside of the program, I would make them local. Otherwise you'll have a mess of variables if you keep using new ones. just do "Local x2,y2,..." for all of the non-standard variables.

Second thing: your program is missing two important things which are "programname()" in the first line and "Prgm" in the second line. Did you just forget to type these?

Third thing: I just typed the code into my 89 exactly as you have it written out (only I put the local in so I didn't get the variables stored on my calculator) and got an error that I had an invalid variable in my local definition. Looking over the variables, I thought y2 was the most likely culprit because the calculator uses y a lot in graphing as its variable. I changed it to yy and then the program executed perfectly. So just change the y2 to yy or any other name and you should be set.

All of that said, it's a very ugly program, no offense to you. The variable names are too long and it isn't clear what they're for. Also, you don't even need the xx1, xx2, yy1, and yy2 because you will never use both parts of the if statement in one execution of the program, so you can just prompt for x, y, x1, and yy. But, if you're interested, i could show you how I would write the program to make it much more visually appealing, more functional, and easier to interpret the results. In short, you don't even use the I/O screen (where prompt and disp go) and you use dialog boxes instead. The coding is slightly trickier and you have to work with strings, but I think you would be much happier with the results. If you are interested, let me know and I can type out the code for you.

-Nathan
 

Related to TI 89 program missing a parenthesis

1. What does it mean when my TI 89 calculator says "program missing a parenthesis"?

This means that there is an error in the programming code of your calculator. It is missing a closing parenthesis in the program, causing it to not function properly.

2. Why am I getting this error message on my calculator?

This error message typically occurs when there is an error in the programming code, such as missing a parenthesis or having too many parentheses. It can also happen if there is a syntax error or a typo in the code.

3. How can I fix this error on my TI 89 calculator?

You can fix this error by identifying where the missing parenthesis should be and adding it into the code. Make sure to also check for any other errors or typos in the code that may be causing the issue.

4. Can I still use my calculator even with this error message?

It depends on the specific program that is causing the error. Some programs may still function despite the error, while others may not. It is best to fix the error to ensure accurate results.

5. Is there a way to prevent this error from happening in the future?

To prevent this error, always double check your programming code for any syntax errors, missing parentheses, or typos before running it on your calculator. It is also helpful to test the program in smaller parts to catch any errors along the way.

Similar threads

Replies
1
Views
2K
  • Computing and Technology
Replies
5
Views
5K
  • Introductory Physics Homework Help
Replies
19
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
907
  • Computing and Technology
Replies
8
Views
10K
  • Computing and Technology
Replies
5
Views
7K
  • Computing and Technology
Replies
2
Views
6K
  • Computing and Technology
Replies
1
Views
4K
  • Computing and Technology
Replies
1
Views
4K
  • Computing and Technology
Replies
1
Views
2K
Back
Top