CS120
Programming Assignment #2

Due by Friday January 26 at 11:59 pm.

For this assignment you will be creating a new program to perform very simple calculations for a user. The general format will be very similar to that of the Fortune Teller program, so feel free to reference that program for ideas. Be sure to test your program on the course server.

The calculator program should work as follows:

If you can't complete the entire assignment, be sure to describe what you've completed in the comments at the beginning of the program. On the other hand, if you did extra work on the assignment (and sometimes you will want to) also describe the extra work in the comment at the beginning of the program.

Include a block of comments at the beginning of the program (or add to the existing block) that lists your name, section number, date, and the assignment number. Also include comments on any parts of the assignment you didn't finish or on any extra work you did. Include this comment block at the beginning of every assignment and lab.

For now we are going to assume that the user enters the right type of data (e.g. a number for the values). Later we will start to look at detecting and correcting user input errors. This is called input validation and is a big topic. You could try entering a letter instead of a number if you want - typing control+C will stop the program.

To produce the program output do the following:
1) Type script output1.txt
2) Run the pwd command.
3) Run the program.
3a) Rerun the program several times with different inputs, testing different operations (addition, subtraction, etc).
4) When you feel you have tested the program sufficiently type exit to halt the script command.
5) Look for a file called output1.txt. Use nano or some other editor to open the file and look at it. It should contain a 'transcript' of your program.

Turn in: Turn in the source code for your program and the output (in output1.txt) showing that the program works as specified via Canvas.