Starting from:
$35

$29

Programming Assignment 1 Solution

Objectives:




Introduction to MASM assembly language
Defining variables (integer and string)
Using library procedures for I/O
Integer arithmetic






Display your name and program title on the output screen.



Display instructions for the user.
Prompt the user to enter two numbers.
Calculate the sum, difference, product, (integer) quotient and remainder of the numbers.
Display a terminating message.



The main procedure must be divided into sections: introduction



get the data




calculate the required values display the results

say goodbye




The results of calculations must be stored in named variables before being displayed.
The program must be fully documented. This includes a complete header block for identification, description, etc., and a comment outline to explain each section of code.
Submit your text code file (.asm) to Canvas by the due date.



A program shell (template) is available on the course website.



You are not required to handle negative input or negative results.
You may submit only one of your programs up to 48 hours late without penalty. Try not to use this on the first program. A second late submission will not be accepted.
To create, assemble, run, debug, and modify your program, follow the instructions at http://www.kipirvine.com/asm/gettingStartedVS2015/index.htm.
(Or other version for different version of Visual Studio)

Find the assembly language instruction syntax in the textbook.
Find help on using Irvine library procedures in in the textbook.



Example execution (user input is in italics):

Elementary Arithmetic by Wile E. Coyote




Enter 2 numbers, and I'll show you the sum, difference, product, quotient, and remainder.

First number: 37




Second number: 5




37+5=42




37-5=32

37 x 5 = 185

37 ÷ 5 = 7 remainder 2




Impressed? Bye!

Extra-credit options (original definition must be fulfilled):




Repeat until the user chooses to quit.
Validate the second number to be less than the first.
Calculate and display the quotient as a floating-point number, rounded to the nearest .001.



To ensure you receive credit for any extra credit options you did, you must add one print statement to your program output PER EXTRA CREDIT which describes the extra credit you chose to work on. You will not receive extra credit points unless you do this. The statement must be formatted as follows...




--Program Intro--




**EC: DESCRIPTION




--Program prompts, etc—




For example, for extra credit option #2:




Elementary Arithmetic by Wile E. Coyote




**EC: Program verifies second number less than first.




Enter 2 numbers, and I'll show you the sum, difference, product, quotient, and remainder.

First number: 7




Second number: 9




The second number must be less than the first!




Impressed? Bye!

More products