Implement the following C++ code fragment

COSC 2425 – Project 2

Part 1

Implement the following C++ code fragment in assembly language. Use the block structured .IF and .WHILE directives. Assume that all variables are 32-bit integers.

int array[] = {3,1,4,1,5,9,2,6,5,3,5,8,9,7,9,3,2,3,8,4,6,2,6,4};

int lower = 4;

int upper = 9;

int ArraySize = sizeof array / sizeof lower;

int index = 0;

int sum = 0;

while( index < ArraySize )

{

if( array[index] >= lower && array[index] <= upper )

{

sum += array[index];

}

index++;

}

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 3,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 

 

$2,000 and above

Platinum

 

$1,500 to $1,999

Gold

 

$1,000 to $1,499

Silver

 

$500 to $999

Bronze

 

$1 to $499

Copper

  • attachment

    InstructionsforCOSC2425ProgrammingProject21.docx

LOOKING FOR THIS ASSIGNMENT OR A SIMILAR ONE? WE HAVE HAD A GOOD SUCCESS RATE ON THIS PAPER! ORDER WITH US TODAY FOR QUALITY WORK AND GET A DISCOUNT!

ORDER NOW

Disclaimer:

All types of paper that Discount Writers provides is only for the purpose of assistance! No text, paper, assignment, discussion would be similar with another student therefore guaranteeing Uniqueness and can be used with proper references only!

More tools: Better Grades: Choose your Homework Help:

Assignment Help: We would write your papers according to the instructions provided and guarantee you timely work

 

Entire Online Class Help: We are here for you and we would do your entire Class work from discussions, assignments, Replies, Exams and Quizzes at a Cost

 

Exam/ Quiz Help: We have a team of writers who specialize on exams from any specific field and we would give you an A+ Grade!

 

ORDER NOW