Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write and test a MIPS assembly language program that determines if three positive integers entered by a user form a Pythagorean Triple. A Pythagorean

1. 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: . 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 nonpositive 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. Please document all sources (Web, in particular) used to complete this project. (Note: I strongly recommend reviewing the Academic Integrity Policy on the CMPSC 312 syllabus.) Additional Note: You may work on this programming project with one of your classmates. If you decide to do so, please submit one electronic copy and one paper copy containing both of your names. References: MIPS resources posted on Canvas (electronic books, lecture slides, demo programs)

image text in transcribed

1. 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. . Please document all sources (Web, in particular) used to complete this project. Note: I strongly recommend reviewing the Academic Integrity Policy on the CMPSC 312 syllabus.) Additional Note . You may work on this programming project with one of your classmates. If you decide to do so please submit one electronic copy and one paper copy containing both of your names References . MIPS resources posted on Canvas (electronic books, lecture slides, demo programs) 1. 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. . Please document all sources (Web, in particular) used to complete this project. Note: I strongly recommend reviewing the Academic Integrity Policy on the CMPSC 312 syllabus.) Additional Note . You may work on this programming project with one of your classmates. If you decide to do so please submit one electronic copy and one paper copy containing both of your names References . MIPS resources posted on Canvas (electronic books, lecture slides, demo programs)

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

Step: 3

blur-text-image

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

SQL For Data Science Data Cleaning Wrangling And Analytics With Relational Databases

Authors: Antonio Badia

1st Edition

3030575918, 978-3030575915

More Books

Students also viewed these Databases questions