Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a MARIE assembly language program that calculates and displays the perimet

ID: 672775 • Letter: W

Question

Write a MARIE assembly language program that calculates and displays the perimeter or the area of a rectangle, given the length of each side, depending on the user’s input.

The user should be prompted to enter the length of each of the sides; once these values have been read by the program, provide the user with the options to select which calculation to perform on the rectangle, and prompt them to enter one of the options.

For example: Enter Perimeter(P) or Area(A)

The application should accept a character corresponding to one of the actions: P for Perimeter or A for Area. The output statements should accurately describe the results being displayed. For example, if the input is:

4 (for one side)

5 (for the other side)

A (for calculation type)

Your program should print something like this: The area of the rectangle is 20.

Explanation / Answer

001 LOAD X     //load value for one side (L)

002 LOAD Y     //load value for another side (W)

003         JNS A        //area of rectangular multiplication (L* W)

004 STORE A     //Store Value

005 CLEAR       

006         LOAD X       //Load one side value (L)

007         ADD Y        //Add another side value (W)

008       STORE B      //Store (L+W)

009        ADD B        //Double value of B 2*(L +W)

010       STORE P      //Store Perimeter value of rectangular

011        HALT

012 X,    Dec 4 //L= 4

013 Y.   Dec 5 //W = 5

014       END

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote