Difference between revisions of "CSC103 2011 Homework 3"

From dftwiki3
Jump to: navigation, search
(Problem #1)
Line 9: Line 9:
 
__TOC__
 
__TOC__
 
<br />
 
<br />
 +
You may find the information in the following two documents very useful for working on this homework:
 +
* [http://math.hws.edu/TMCM/java/labs/xComputerLab1.html xComputer Lab 1]
 +
* [http://math.hws.edu/TMCM/java/labs/xComputerLab2.html xComputer Lab 2]
 +
 
=Problem #1=
 
=Problem #1=
  
Line 14: Line 18:
  
 
* When you program works correctly, copy it to a text file of your choice.  Save the file for right now.
 
* 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 (as described in [http://math.hws.edu/TMCM/java/labs/xComputerLab2.html xComputer Lab 2])
  
 
=Problem #2=
 
=Problem #2=

Revision as of 13:02, 15 February 2011



This homework is due on Monday, Feb. 21st, 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

  • Use the Processor/Memory simulator and write a program that starts with 4 numbers stored in memory Locations 14, 15, 16, 17, and that stores the sum of all 4 in memory Location 18.
  • When you program works correctly, copy it to a text file of your choice. Save the file for right now.

Problem #2

  • Write another program that computes the sum of the integers 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10, and stores the sum in Memory Location 20 (or other convenient location). Your program should stop when it has finished adding the number 10 to Memory Location 20.
  • Make your program store the ten numbers 1, 2, 3, ... 10 in 10 memory locations, and add them up to compute the sum
  • Your program should stop automatically 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 ten 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 to a file to the end of the same file as Problem 1 and Problem 2.

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.