Answer to Question #267223 in C++ for moymoy

Question #267223

The following are the assumed existing equivalent currency rates corresponding to the US dollar ($1.00); Australia (Aus $), 1.09; Hong Kong (HK $), 7.81; Indonesia (Rupiah), 990.41; Japan (Yen), 234.93; Malaysia (Ringgit), 2.34; Philippines (Peso), 13.80. Prepare a program that will accept US dollar and currency to be converted as inputs, then compute the equivalent in the chosen foreign currency. Print the results.

 

(Use switch statement.) 


1
Expert's answer
2021-11-17T06:28:23-0500
#include<iostream>
using namespace std;
int main()
{
    double dollars;
    int currency;
    cout<<"\nEnter currency dollars to be converted: ";
    cin>>dollars;
    cout<<"\n1. Australia (Aus $)";
	cout<<"\n2. Hong Kong(HK $)\n3. Indonesia (Rupiah)";
    cout<<"\n4. Japan (Yen) ";
	cout<<"\n5. Malaysia (Ringgit)";
	cout<<"\n6. Philippines (Peso)";
    cout<<"\nChoose the currency to be converted to: ";
    cin>>currency;
    
    switch(currency){
    case 1:
        cout<<"Equivalence is: Aus $"<<dollars*1.09;
        break;
    case 2:
        cout<<"Equivalence is: HK $"<<dollars*7.81;
        break;
    
    case 3:
        cout<<"Equivalence is: Rupiah "<<dollars* 990.41;
        break;
    case 4:
        cout<<"Equivalence is: yen "<<dollars*234.93;
        break;
    
    case 5:
        cout<<"Equivalence is: Ringgit "<<dollars*2.34;
        break;
    
    case 6:
        cout<<"Equivalence is: Peso "<<dollars*13.80;
        break;
    default:
         cout<<"Invalid choice";
         
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS