Part 1:
Write a program that takes 2 integers as input and outputs their sum and product. Test your program with multiple sets of inputs. In other words, run your program multiple times giving different values for the input each time.
For both Part 1 and Part 2, experiment with entering the wrong type of data at the keyboard (e.g. try to input character data into a variable of type int, etc.). What happens?
Part 2:
Modify the program from Part 1 to take 2 inputs of type double instead of int. Again, test it with multiple sets of inputs (with both correct and incorrect types).
Part 3:
Write a program that takes two doubles as input using one cin statement to read in both values. Be sure to
prompt the user to enter 2 values. Output the 2 numbers and their quotient with exactly one digit after the decimal point.
Format your output to look like this:
         first_number / second_number = quotient. (e.g. 48.0 / 1.2 = 40.2)
Part 4:
Turn in the program from Part 3 using the electronic single-file turnin for CS10. Use the link provided on the CS10 class webpage "http://www.cs.ucr.edu/cs10/cs10_04win/cs10_04win.html".
Be sure to choose the correct project for your lab section. For example, if you are in lab section 21, the project you should turn in your program to will be called lab2-sec21.
Make sure you get a message stating a successful turnin
with the correct file name. Let the TA know when you have completed this. He will verify your file was turned in
properly.
DO NOT LEAVE LAB WITHOUT VERIFYING YOU HAVE TURNED IN A FILE CORRECTLY!!
Part 5:
Write an algorithm (in English) for the following problem definition:
Convert the number of days until Spring Break to the number of hours until Spring Break, the number of minutes until Spring Break, the number of seconds until Spring Break, and finally the number of months until Spring Break. The number of days will be provided by the user.
Part 6:
Translate the algorithm from Part 5 into a C++ program. Use integer variables.
Your program should output the number of hours, the number of minutes, the number of seconds, and the number of months (assume 1 month = 30 days) until Spring Break, each on a separate line. Your output should look something like this:
         Enter the number of days until Spring Break:Now change the variables to doubles and recompile and run your program again.
Part 7:
Find someone who has completed the program for Part 6 and exchange code with them. Change your partner's code to
cause one or more syntax errors then pass it back to them. Do not tell them where you made changes. When you get your
code back, recompile the program to find and correct the syntax errors. Keep a log of all errors and their corrections.
Some examples to use are:
Turn in your error/correction log electronically to the same project as in Part 4. Be sure to include your name, your partner's name, and the last 4 digits of your student id number.