3. a. (8 marks) Note that this enhanced version of the Toy has a subtraction instruction, sub, and another branching instruction, ifnos. There is no division instruction, but maybe we can crudely approximate one by doing repeated subtractions to let the Toy calculate an integer average of a list of numbers. To keep things as simple as possible, we will arbitrarily specify that this program need only work for a list of non-zero positive integers, and that (as with the previous two programs) input will stop when a 0 is entered. NOTE: Sometimes this program will work with negative integers in the input, but if the overall sum of the numbers is negative, it will give incorrect results. Start with your Labo3_2.toy code and copy it into a new editor file called Lab03_3.toy. (Be careful not to overwrite Lab03_2.toy.) Make the following additions to the code: Add two new memory address labels at the bottom of the code, ayg and rem. Give both initial values of 0.4 b. Insert the following code between the final print instruction and the stop instruction. Note that I said between the final print and the stop instructon: stop should still be the last instruction executed. Type carefully to catch any errors. calcavg load sume ifres sont goto showavg stork rem sub counte store sume ifrea incang goto calcavg incavg_load ayge add 1 store avge got satsange showag load avge print load rem printe Save your work in the text editor frequently, so that if something needs fixing you will not lose what you've done. Include your completed Lab03_3.toy program in your zip file submission cont C. d. Run the program (at least) three times, using the following input data, noting what values print out for avg and rem in each case. Note that the value at the end of each of these lists signals an end to input and is NOT used in the average calculations. Input sequence Value printed for avg Value printed for rem 1, 2, 3, 4, 5, oe iie 6, 8, 4, 2, 1,704 e iii. 12, 13, 14, 3,00 Hint: The last two numbers printed out are the values of ayg and rem. Confirm (by actually doing the arithmetic - you may want to use the calculator built into Windows, or the one built into your cell phone for the purpose, if you can't do it in your head) that the numbers printed for the axg value are the integer portions of the actual averages of the number series you've entered. Study the values printed out for the rem values. What do you think rem is short for? Hint: If you get stuck for an answer to that question, open a Web browser, go to https://goo.gl/vLIKWU, and read point 4. 3. a. (8 marks) Note that this enhanced version of the Toy has a subtraction instruction, sub, and another branching instruction, ifnos. There is no division instruction, but maybe we can crudely approximate one by doing repeated subtractions to let the Toy calculate an integer average of a list of numbers. To keep things as simple as possible, we will arbitrarily specify that this program need only work for a list of non-zero positive integers, and that (as with the previous two programs) input will stop when a 0 is entered. NOTE: Sometimes this program will work with negative integers in the input, but if the overall sum of the numbers is negative, it will give incorrect results. Start with your Labo3_2.toy code and copy it into a new editor file called Lab03_3.toy. (Be careful not to overwrite Lab03_2.toy.) Make the following additions to the code: Add two new memory address labels at the bottom of the code, ayg and rem. Give both initial values of 0.4 b. Insert the following code between the final print instruction and the stop instruction. Note that I said between the final print and the stop instructon: stop should still be the last instruction executed. Type carefully to catch any errors. calcavg load sume ifres sont goto showavg stork rem sub counte store sume ifrea incang goto calcavg incavg_load ayge add 1 store avge got satsange showag load avge print load rem printe Save your work in the text editor frequently, so that if something needs fixing you will not lose what you've done. Include your completed Lab03_3.toy program in your zip file submission cont C. d. Run the program (at least) three times, using the following input data, noting what values print out for avg and rem in each case. Note that the value at the end of each of these lists signals an end to input and is NOT used in the average calculations. Input sequence Value printed for avg Value printed for rem 1, 2, 3, 4, 5, oe iie 6, 8, 4, 2, 1,704 e iii. 12, 13, 14, 3,00 Hint: The last two numbers printed out are the values of ayg and rem. Confirm (by actually doing the arithmetic - you may want to use the calculator built into Windows, or the one built into your cell phone for the purpose, if you can't do it in your head) that the numbers printed for the axg value are the integer portions of the actual averages of the number series you've entered. Study the values printed out for the rem values. What do you think rem is short for? Hint: If you get stuck for an answer to that question, open a Web browser, go to https://goo.gl/vLIKWU, and read point 4