Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Currency Write a program that will convert U.S. dollar amounts to Japanese yen a

ID: 3595581 • Letter: C

Question

Currency

Write a program that will convert U.S. dollar amounts to Japanese yen and to euros, storing the conversion factors in the constants YEN_PER_DOLLAR and EUROS_PER_ DOLLAR. To get the most up-to-date exchange rates, search the Internet using the term “currency exchange rate”. If you cannot find the most recent exchange rates, use the following:

1 Dollar = 98.93 Yen

1 Dollar = 0.74 Euros

Format your currency amounts in fixed-point notation, with two decimal places of precision, and be sure the decimal point is always displayed.

Explanation / Answer

#include <iostream>
#include <iomanip>
using namespace std;
#define YEN_PER_DOLLAR 98.93

#define EUROS_PER_DOLLAR 0.74

int main() {
int dollars ;
cout<<"Enter the US dollar amount: "<<endl;

cin >> dollars ;

double yens = dollars * YEN_PER_DOLLAR;

double euros = dollars * EUROS_PER_DOLLAR;

cout<<fixed<<setprecision(2)<<"Yens: "<<yens<<endl;
cout<<fixed<<setprecision(2)<<"Euros: "<<euros<<endl;

return 0;

}

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote