Write an assembly language program that accumulates and reports the sales for th
ID: 3685185 • Letter: W
Question
Write an assembly language program that accumulates and reports the sales for the Albatross Corporation. The Albatross Company has four salespeople who sell five different products. The four salesperson are each identified by a number from 1 to 4. Each products is identified by a number from 1 to 5. Sales are reported by entering the salesperson’s number, the quantity sold, and the product number. For example, to report that salesperson 2 sold 100 units of product 4, you would enter 2 100 4.
Your program must store the sales data in a two-dimensional array (4 rows by 5 columns). Each row represents a salesperson. Each column represents a product. Initialize the array to zeroes and allow your user to enter data. When the user enters a negative number for a salesman number, terminate the input phase of your program and display a report that shows the total sales for each salesperson and the total sales for each product.
Section 9.4 of our textbook discusses two-dimensional arrays. Section 9.4.2 discusses Base-Index Operands and even contains an example of how to calculate a row sum for a two-dimensional array.
Explanation / Answer
INCLUDE Irvine32.inc
.data
str0 byte "Albatross Company Sales Report",0
str1 byte "Enter the salesperson number, number of units and product number",0
tableA byte 0,0,0,0,0
Rowsize = ($ - tableA)
byte 0,0,0,0,0
byte 0,0,0,0,0
byte 0,0,0,0,0
.code
main proc
mov edx,offset str0
call WriteString
call crlf
mov edx,offset str1
call WriteString
call crlf
call ReadInt
mov ebx,offset tableA
mov esi,2
mov ax, [ebx+esi]
exit
main endp
end main
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.