Jonathan Booth Copyleft 1996, Intersession '96 Jonathan Booth -- The Tcl Language -- -- In-class Programming Problems -- These problems are REQUIRED. You may think that they are too easy, but I still want you to do them. Once you're done, drop them in the students.work directory in /home/kamikaze/session/. You won't be able to see in that dir, and if you make a mistake, please change it's name so I can see it easily. I'd prefer if you name you files something like: you_last_name-problem_number.tcl for me, this would be booth-2.tcl and if I then had a new version, I would call it booth-2.1.tcl or something like that. If you would like to see some example code (please don't copy it!) try looking in /home/kamikaze/session/my.work. I've coded all the problems I'm asking you to do, and I've also included the time I took to get them working. If you don't understand a problem, please, ask us about it! Problems: 1. Write a simple program that takes input from a user and outputs it back at them in reverse order (characters reversed). the command: puts [-nonewline] [filehandle] "[what]" is what you'll want to use to output stuff. -nonewline means a carriage return is not appended to the text, so you can write on one line instead of many. filehandle is generally stdout (the STanDard OUTput device, ie: the screen). 2. Write a script to add and subtract two numbers. You should input the desired evaluation in RPN (reverse polish notation). Example: input string: 1 2 + the value of 1 + 2 is 3 3. Write a probability of hit generator. It should make an array from 1 to n (user specified), and do a certain number (again, user specified) of hits throughout the array, counting up as each place is hit. Then print out in numeric order (print array(1) to array(n)). The code for a random number generator is in /home/kamikaze/session/my.work/random.tcl. Just add it and call the random function with whatever value you want to go up to (range is 0..(value-1)). *** Note: I may tell you to cross this problem off. If you get a 'floating exception' when working on this, please tell me. *** 4. Write a digital root problem. What this problem is is the user enters a number, you are to take it, multiply all the digits together (ignore 0s) and save that value. Now do this again and again until you have only 1 digit. y