Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a MIPS program that contains some subroutines which perform specific tasks based on the following requirements: 1 - A subroutine called display _ main

Write a MIPS program that contains some subroutines which perform specific tasks based on the following
requirements:
1- A subroutine called display_main_menu() that displays the main menu.
2- A subroutine called compute_a_series_of_nums() that computes the series based on the end of series value entered
by the user. Note: The subroutine should deal with the numbers as double or float numbers.
Example:
if a user inputs 3, then the subroutine will compute this series of numbers: 1/1+1/2+1/3
3- A subroutine called print_array() that prints array elements. If the array is empty, the message "Array
is empty" should be displayed.
The main program will do the following:
a. Display a menu to allow the user to choose any option and perform the corresponding actions. See below.
Menu:
Welcome to main menu!
Enter 0 to end the program
Enter 1 to compute the series
Enter 2 to deal with array
b. If the user chooses option 1, the user will be prompted to enter the end of series and will call the
subroutine compute_a_series_of_nums() to compute the series. See below.
Welcome to main menu!
Enter 0 to end the program
Enter 1 to compute the series
Enter 2 to deal with array
Enter the choice: 1
Enter the end of series: 5
Sum is 1.283333
c. If the user chooses option 2, another menu will be displayed which contains the following
choices. See below
Welcome to main menu!
Enter 0 to end the program
Enter 1 to compute the series
Enter 2 to deal with array
Enter the choice: 2
Enter 1 to add an element to the array
Enter 2 to display the array elements
Enter 3 to return to the main menu
If the user enters 1, the program will ask the user to enter a number and store it in the
array. See below.
Enter 1 to add an element to the array
Enter 2 to display the array elements
Enter 3 to return to the main menu
Enter the choice: 1
Enter the value: 10
>>The value is added
If the user enters 2, the program will call the subroutine print_array(). See below.
Enter 1 to add an element to the array
Enter 2 to display the array elements
Enter 3 to return to the main menu
Enter the choice: 2
Array elements: 10
If the user chooses option 3, the program will return to the main menu. See below
Enter 1 to add an element to the array
Enter 2 to display the array elements
Enter 3 to return to the main menu
Enter the choice: 3
Welcome to main menu!
Enter 0 to end the program
Enter 1 to compute the series
Enter 2 to deal with array
d. If the user chooses option 0 from main menu, the program will print a final message and will
exit. See below.
Welcome to main menu!
Enter 0 to end the program
Enter 1 to compute the series
Enter 2 to deal with array
Enter the choice: 0
>> Thank you for using the program
e. The program should repeat until the user chooses option 0*IMPORTANT*
*Please show full code.

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

Students also viewed these Databases questions