CS 3443 Computer System, Fall/2009

Program 2

Due date: Midnight of 12/04/2009.

 

Write a program that computes the quotient and remainder using IJVM instructions and mic1 software.

 

The inputs are two hex numbers a and b from the keyboard. You need subtract b from a, until the result is less than b, and the number of subtractions is the quotient. For example, if you press 1A and 3, then the output should be something like this:

 

1A

3

========

quotient: 00000008

remainder: 00000002

 

You should use “1”-“9” and upper-case “A”-“F” for the hex digits.

You can simply modify the program example add.jas.

Name your program as quo_rem.jas.

You need four methods. You can copy two methods (get number and print result) from the author, and you need to write two new methods (quotient and remainder).

 

You should give detail comments for your source code.

A brief discussion is needed. You algorithm should be given in this discussion.

 

I will assemble and test your program.

 

Please start your program as soon as possible and do not wait until last minute.

 

The late programming assignments will be accepted with 10% penalty for each day (include weekends and holidays).