Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MIPS 1. Write an assembly language program shapes.s that prompts the user for and reads four integers (x1, y1, x2, y2) which represent the coordinates

MIPS

1. Write an assembly language program shapes.s that prompts the user for and reads four integers (x1, y1, x2, y2) which represent the coordinates of two points. Make sure you keep track of which number is which.

2. Treat the line between the points as the radius of a circle and compute the area of the circle. Print the output with a label, such as The area of the circle is: . Test the problem with the following data: x1: 1, y1: 1, x2: 2, y2: 2 Area: 6 x1: 3, y1: 5, x2: 7, y2: 9 Area 100 Hint: The distance between the points is the square root of ((x2 x1)2 + (y2 y1)2). However, since you have to square the radius, to get the area, you dont need to worry about the square root. To work with , do what the text does on page 14. Use 314156 as and do the calculations. At the end, divide by 100000 and the quotient is your answer. Note that the answer will be an integer, which is fine.

3. Once part 2 is working properly, add code (do not delete your code for part 2) to treat the line between the points as the side of a square and compute the area of the square. This is exactly what you did in part 2 except for the multiplication by . However, it might make it easier to do the rest of the lab if you copy the calculation code and put it in the program a second time. Print the output with an appropriate label. Test the code with the same data as in part 2. The results should be 2 for the first data set and 32 for the second data set.

4. Once part 3 is working properly, add code to treat the line as the diagonal of a rectangle and compute the area of the rectangle. This is simply (x2 x1) * (y2 y1). Output the results with an appropriate label. Test the code with the same data as before. The results should be 1 for the first data set and 16 for the second data set.

5. Add labels above each of the calculation code segments such (circle:, square: and rectangle:). Add a menu to the program that prompts the user as follows: To quit enter 0 To calculate the area of a circle enter 1 To calculate the area of a square enter 2 To calculate the area of a rectangle enter 3 If the user enters 0, the program terminates. Otherwise, the user enters the four values and you branch to the correct calculation area and output area. This may require several branching instructions. Once a calculation is made, you loop back to the menu.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Describe how to measure the quality of work life.

Answered: 1 week ago

Question

What attracts you about this role?

Answered: 1 week ago

Question

=+2 How can the effectiveness of global virtual teams be improved?

Answered: 1 week ago

Question

=+1 What are the major issues related to international T&D?

Answered: 1 week ago