CSC103 2011 Homework 3 Version 2

From dftwiki3
Jump to: navigation, search



This homework is a variation of the original CSC103 2011 Homework 3, which was due on Monday, Feb. 21st, Tuesday, Feb. 22nd, at 9:00 a.m. You should make sure that you have gone through all the steps of Lab #3 as preparation for this homework.



You may find the information in the following two documents very useful for working on this homework:

Problem #1 (Version 2)

  • Use the Processor/Memory simulator and write a program that starts with 6 numbers stored in memory Locations 15 and up and that stores the sum of all 6 in memory Location 28.
  • When you program works correctly, copy it to a text file of your choice. Save the file for right now.
  • Use labels in your program for instructions and for data (as described in xComputer Lab 2).
  • Format your program neatly, so that all the labels start at the left margin, all the instructions are one above the other, all the comments (if any) one on top of the other.

Problem #2 (Version 2)

  • Write another program that computes the sum of the integers 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 and 110, and stores the sum in a memory location labeled as sum. Your program should stop when it has finished adding the number 110 to the location sum.
  • Make your program store the eleven numbers 10, 20, 30, ... 110 in 11 different memory locations, and add them up to compute the sum
  • Your program should stop when it is done.


  • As with Problem 1, copy your solution program at the end of the file you created for Problem 1.

Problem #3

  • Same as Problem #2, but without storing the eleven numbers in memory. The program should generate all the numbers required in the accumulator, and use only 1 memory location to store data.
  • As with Problem #2, copy your solution at the end of the same file containing the other answers.

Problem #4

  • Same as Problem #3, but your program this time will compute the sum of only the numbers that are multiple of 10 with an even first digit, between 0 and 100. In other words, make your program compute the sum of 20 plus 40, plus 60, plus 80, plus 100 using a loop.
  • As with Problem #3, copy your solution at the end of the same file containing the other answers.

Recommendations

  • Programming is the art of writing complex instructions that a machine will have to execute. It can be very tedious to read computer code. The neater you are in writing your code, the more comments you add to your code, the easier it is to read and understand.
  • Make sure you write your code as neatly as possible!

Submission

  • Email the file containing the solution to all 3 problems as an email message (no attachment, please!), and address it o 103b@cs.smith.edu. Make sure your name is at the top of the text of your message.