133k views
4 votes
Ln assembly language initially prompt the user for a name followed by the number of times money was spent (name should have a max of 40 char). As for the possible spending, it should be no more than 80 times. Allocate arrays for the names and the spending amounts (for each person). Also, develop a procedure to get the name and number of items (number of items is NOT an array) - use the esi and edi registers to pass offsets. With the names and number of items, use a procedure to store amounts as read from the user. If the first person spent 5 times, load the first 5 slots of their array. Before getting the amounts, clear the screen and show the person's name, make sure to use the esi and edi registers. Use the same procedure for both persons, call it with each person, then use a procedure to compute the total for one person. Again, use esi and edi to pass needed offsets. Call it twice. Finally, write a procedure to display a summary of a person. Pass any offsets that you need so that you can use this procedure with each person. In order to avoid real numbers and the 32-bit binary they require, store all spending data in cents. Use dwords

MAKE SURE TO:
Use dwords
document in each procedure what it "receives" and "returns"
Use uses identifiers on any procedure that requires safeguarding of registers
Get a screenshot of each data entry point before you clear the screen and at the end
Use only the eax, ebx, ecx, and edx registers for your processing. Use the esi and edi registers to cycle through arrays.
USE THE FOLLOWING VARIABLES:
person1 spending (an array of up to 80), person 2 spending (same as person 1), sizes (maybe an array holding the number of items of each person - entered from user), totals (also a possible array - you need a total for each), and the names (one array with a max size of 40 - one per person).

1 Answer

3 votes

Final answer:

To collect the data in assembly language, prompt the user for a name and the number of times money was spent. Use procedures to get the name and number of items, store amounts as read, compute the total spending, and display a summary of a person. Allocate arrays for names and spending amounts.

Step-by-step explanation:

To collect the data required in assembly language, you would need to prompt the user for a name and the number of times money was spent. In this case, the name can have a maximum of 40 characters and the spending amount should be no more than 80 times. You would need to allocate arrays for the names and spending amounts for each person.

Using a procedure, you can get the name and number of items from the user, using the esi and edi registers to pass offsets. Then, you can use another procedure to store the amounts as read from the user. For example, if the first person spent 5 times, you would load the first 5 slots of their array.

Before getting the amounts, you would clear the screen and display the person's name using the esi and edi registers. You can use the same procedure for both persons and call it with each person.

After that, you can use another procedure to compute the total spending for one person, using the esi and edi registers to pass necessary offsets. You can call this procedure twice, once for each person.

Finally, write a procedure to display a summary of a person and pass any offsets needed to use this procedure with each person. Remember to store all spending data in cents using dwords.

User Freewill
by
7.7k points