THIS IS MIPS ASSEMBLY LANGAUGE Write a MIPS assembly language program that does
ID: 3595267 • Letter: T
Question
THIS IS MIPS ASSEMBLY LANGAUGE
Write a MIPS assembly language program that does currency conversion between US dollar and Japanese Yen.
The program must repeatedly present a menu that has 4 choices:
1) Set the rate: prompts the user to input the exchange rate, e.g. if 1 US dollar = 115 Yen then the user will input 115. The program then stores this information for future use. The initial rate should be set to 115.
2) US $ -> Yen conversion: the program prompts the user for the US amount, then displays the Yen amount.
3) Yen -> US $ conversion: the program prompts the user for the Yen amount, then displays BOTH the US $ amount AND the change in Yen. For example is the input was 250 and the rate is 115, the US $ amount is 2$, and the change is 20 Yen.
4) Exit: the program exits.
and process the choice from the user accordingly.
Note: All numbers are integers, no need for floating point operations.
Explanation / Answer
Here i am providing the MIPS assembly code and c++ code also this will help u to understand the code:-
MIPS ASSEMBLY CODE
C++ CODE
#include <iostream>
using namespace std;
int main()
{
int AMOUNT;
int select;
int n= 115;
while(1)
{
cout<<" Enter 1 to set the rate Enter 2 to yen conversion Enter 3 to US $ conversion enter 4 to exit"<<endl;
cin>>select;
switch(select)
{
case 1:
cout<<"1 US $=";
cin>>n;
break ;
case 2:
cout<<"Enter the amount in $ :- ";
cin>>AMOUNT;
cout<<AMOUNT<<" $ = "<<(AMOUNT*n)<<" YEN"<<endl;
break;
case 3:
cout<<"Enter the amount in YEN :- ";
cin>>AMOUNT;
cout<<AMOUNT<<" YEN = "<<(AMOUNT/n)<<" $ and "<<(AMOUNT%n)<<" YEN"<<endl;
break;
case 4:
break;
}
}
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.