This lab is worth 10 points and accounts for 12.5 percent of your laboratory grade. The points will be subjectively assigned by your TA based upon whether they believe you made a good faith effort toward complete the tasks that are assigned. Showing up on time, respecting your fellow classmates learning environment, and adherance to laboratory policies also factor into the determination of your score.
The following is an outline of the tasks for you to attempt during the lab period.
A framework containing the files and folders you will need can be found here. Download the .tgz file and decompress it in your account using the command:
tar -xzvf <file_name>
Inside the framework folder you will find a folder named headergen. In this folder write a program that prompts the user for the information that is contained in the class header template. ( ie. ask the user for the course number, lecture section, lab section, etc. ) When all of the information has been retrieved from the user, prompt them for the name of a file that they want the header written to and write the header template into that file.
Inside the framework folder you will find a folder named multiply. In this folder there is a text file name input.txt. In the same folder, write a program which reads in two number at a time from the file input.txt and prints out the product of the two numbers to standard output. A run of the program might look something like:
For part 2, instead of writing to standard output, write the output of your program to a file named output.txt.
If you finish the first two tasks, write a program which takes the ouput of the multiplication program ( ie. output.txt ) and evaluates whether the the equality is true or false. A sample run of the program might look like the following:
Think about the following:
Could you write a program that evaluates any arbitrary expression and
determines whether it is true or false? For example, could you
evaluate the expression " 8 * ( 5 + 3 / 9 ) > 0"? Think
about how you would handle parenthesis and order of operations.