Reference no: EM132238083
Assignment - Programming Projects
Project 2 -
Part 1 - Implement the following (in attached file) C++ code fragment in assembly language. Use the block-structured .IF and .WHILE directives. Assume that all variables are 32-bit integers.
Your assembly language program must also display as output the number of times a member of ' array ' qualified for inclusion into the ' sum ' and what the final value of the variable ' sum ' was. (Hint: you may have to add another variable.) Feel free to use the author's procedures in the book's link library. Use only the procedures that were introduced in chapter 5.
Part 2 - Write an assembly language program that asks the user to enter an integer dollar amount between 1 and 5,000. Your program should display the corresponding class description using the following table. Write the program so that it executes until the user inputs some value that you determine to be the "sentinel value". Your program must guard against and provide user messages for input values that are outside the valid range.
Donation Amount (dollars)
|
Class of Donation
|
$4,000 to $5,000
|
Platinum
|
$3,000 to $3,999
|
Gold
|
$2,000 to $2,999
|
Silver
|
$1,000 to $1,999
|
Bronze
|
$1 to $999
|
Copper
|
Project 3 -
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.
Project 4 -
One of the very practical uses of assembly language programming is its ability to optimize the speed and size of computer programs. While programmers do not typically write large-scale applications in assembly language, it is not uncommon to solve a performance bottle neck by replacing code written in a high level language with an assembly language procedure.
In this programming project you will be given a C++ program that generates an array of pseudorandom integers, sorts the array, and then searches the array for a particular value. The C++ program uses the binary search algorithm to determine if the search value is one of the elements in the array. A binary search procedure is considered an efficient way to search an ordered array.
Your job is to write an assembly language procedure that also performs the binary search. The C++ program will time multiple searches performed by both the C++ code and your assembly language procedure and compare the result. If all goes as expected, your assembly language procedure should be faster than the C++ code.
As always, start small. DO NOT be the Cookie Monster and gobble up the whole project at once. Steps you might consider, but are not limited to are:
- Have your assembly language procedure return the number of elements in the array. This will tell you if what is being passed as an argument is the value you expected.
- Have your assembly language procedure return the value of the first element in the array. This will tell you if you understand how to address and retrieve the value of an element in the array.
- Have your procedure return the second (or fifth) element in the array.
- Calculate the subscript of the "middle" element in the array and return the value of that subscript. This will confirm that you can make one of the calculations needed to implement the binary search and retrieve a particular element in the array.
- Calculate the subscript of the "middle" element in the array and return the value of that element in the array. This will confirm that you can retrieve any element in the array.
This project will provide you with the opportunity to:
- Link an assembly language procedure to an existing C++ program.
- Demonstrate your ability to work with a one-dimensional array.
- Show that you can implement a while loop in assembly language.
- Display your understanding of what an assembly language procedure is and how they can be used.
- Provides a chance for you to show that you understand how to compare values and take conditional action based on the results.
- Observe how assembly language procedures can be used to optimize.
Attachment:- Assignment Files.rar