Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write and test a MIPS assembly language program that determines if three positive integers entered by a user form a Pythagorean Triple. A Pythagorean Triple
Write and test a MIPS assembly language program that determines if three positive integers entered by a user form a "Pythagorean Triple." A "Pythagorean Triple" is a set of positive integers, a, b and c that fits the rule: a2 b2-C2 . The program begins by prompting the user to enter three positive integers. Next it performs the calculations and comparisons necessary to determine if the integers form a "Pythagorean Triple." The program then displays an appropriate message (see sample runs), based on the results of the tests. Finally, it asks the user if s/he wants to test more integers. If the user types "1," the program loops again; otherwise, it ends. Be sure to include error-checking code to deal with the possible entry of non- positive integers (i.e., zero or negative), in the event of which an appropriate error message should be displayed and the user prompted to begin again. Your program output should resemble the sample runs at the end of this document Notes The first few "Pythagorean Triples" are (3, 4, 5). (5, 12, 13), and (7, 24, 25). Many more can be viewed at https://www.mathsisfun.com/pythagorean triples.html Your program must correctly process the three integers if they are entered in any order: (3, 4, 5), (4, 3. 5). (1, 2. 3). (3, 2, 1), etc. * * Your program must check for and correctly handle the entry of invalid integers * The program must loop . We did not cover MIPS multiplication in class. See Chapter 2.8 (page 15) of the MIPS Assembly Language Programming book by Robert Britton posted on Canvas for a good example of how to multiply integers in MIPS * Please note that the use of procedures is optional Write and test a MIPS assembly language program that determines if three positive integers entered by a user form a "Pythagorean Triple." A "Pythagorean Triple" is a set of positive integers, a, b and c that fits the rule: a2 b2-C2 . The program begins by prompting the user to enter three positive integers. Next it performs the calculations and comparisons necessary to determine if the integers form a "Pythagorean Triple." The program then displays an appropriate message (see sample runs), based on the results of the tests. Finally, it asks the user if s/he wants to test more integers. If the user types "1," the program loops again; otherwise, it ends. Be sure to include error-checking code to deal with the possible entry of non- positive integers (i.e., zero or negative), in the event of which an appropriate error message should be displayed and the user prompted to begin again. Your program output should resemble the sample runs at the end of this document Notes The first few "Pythagorean Triples" are (3, 4, 5). (5, 12, 13), and (7, 24, 25). Many more can be viewed at https://www.mathsisfun.com/pythagorean triples.html Your program must correctly process the three integers if they are entered in any order: (3, 4, 5), (4, 3. 5). (1, 2. 3). (3, 2, 1), etc. * * Your program must check for and correctly handle the entry of invalid integers * The program must loop . We did not cover MIPS multiplication in class. See Chapter 2.8 (page 15) of the MIPS Assembly Language Programming book by Robert Britton posted on Canvas for a good example of how to multiply integers in MIPS * Please note that the use of procedures is optional
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started