Question: PLEASE WRITE IN MIPS! Focus: Basic arithmetic instructions, system calls, and control flow. Objectives: You will write a program that will input ODD integers between

PLEASE WRITE IN MIPS!

Focus:

Basic arithmetic instructions, system calls, and control flow.

Objectives:

You will write a program that will input ODD integers between 1 and 25 inclusive. As each valid number is input, it will be added to a total and a counter will be incremented. The program will stop once a cardinal value of -1 is input, and will display the sum of all valid inputs, the count, the integer average, and the remainder before the program ends. If any invalid input is entered (i.e. less than -1, greater than 25, or is an even number), an error message should be printed to the console, the input should be ignored, and the user re-prompted to enter another integer. If -1 is entered first, your program should a message indicating as such it should not crash!

Other Requirements:

  • You should start with the skeleton file main_template.s
  • Make sure to write your name, date, and a brief description of the program (in your own words!) at the top of the page where prompted in the comments.
  • You should write comments as you go along, where appropriate, to indicate whats happening in your program. You dont need to go overboard its not necessarily needed for every instruction, just enough to get a general picture.
  • Fill out the Registers section with the registers you used and the purpose for which you used them for.

Tips:

When working on MIPS programs, it is recommended to take things one step at a time and test your program as you complete each objective. Doing too much at once can create confusion and make it much more difficult to catch bugs! For example, here is a recommended (not required!) method for approaching this program:

  • Determine what registers you want to use and their purpose;
  • Create the string variables youll use in your program in the .data section;
  • Write and test the ability to prompt and input an integer from the user;
  • Write and test the logic to prompt and input a certain number of integers from the user (such as 10);
  • Add the arithmetic calculations and print them to the console with their strings;
  • Add the logic to check for input outside of valid range and test;
  • Add the logic to check for even input;
  • Add the logic to stop input once -1 has been entered, instead of stopping after a certain number of inputs.

Sample Output:

PLEASE WRITE IN MIPS! Focus: Basic arithmetic instructions, system calls, and controlflow. Objectives: You will write a program that will input ODD integers

Console Enter a non-negative odd number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!