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

Please show steps in writing this program. Any comments would be appreciated. Pl

ID: 3630241 • Letter: P

Question

Please show steps in writing this program. Any comments would be appreciated. Please go over as I'm a newbie programmer. Thank you for your consideration in this matter.

Problem 2
Write a currency conversion program converter.c that does the followings:
prompts the user for the double-precision1 exchange rates of Euro and Pound to Dollar (that is how many dollars can one get for one euro or one pound).
prompts the user for the integer amount of money and the currency (D for dollar, E for euro,and P for pound) she/he would like to convert from.
prompts the user for the currency she/he would like to convert to.
outputs the conversion result with a 2-decimal point precision.
You can assume that the two currencies will always be different. Here is a sample run:
(~)$ a.out
Exchange rate of Euro to Dollar: 1.32
Exchange rate of Pound to Dollar: 1.51
Amount and currency you want to convert from: 250 D
Currency you want to convert to: E
250 dollars are equivalent to 189.39 euros.
(~)$ a.out
Exchange rate of Euro to Dollar: 1.32
Exchange rate of Pound to Dollar: 1.51
Amount and currency you want to convert from: 4000 E
Currency you want to convert to: P
4000 euros are equivalent to 3496.69 pounds.

Explanation / Answer

please rate - thanks

#include <conio.h>
#include <stdio.h>
int main()
{double euro,pound,amt,converted;
char from,to;
printf("Exchange rate of Euro to Dollar: ");
scanf("%lf",&euro);
printf("Exchange rate of Pound to Dollar: : ");
scanf("%lf",&pound);
printf("Amount and currency you want to convert from: ");
scanf("%lf%c%c",&amt,&to,&from);
while (getchar()!= ' ');
printf("Currency you want to convert to: ");
scanf("%c",&to);
if(from=='D')
    {if(to=='E')
        {converted=amt/euro;
        printf("%.2f dollars are equivalent to %.2f euros. ",amt,converted);
        }
    else if(to=='P')
        {converted=amt/pound;
        printf("%.2f dollars are equivalent to %.2f pounds. ",amt,converted);
        }
    else
        printf("invalid to currency ");
        }
else if(from=='E')
     { if(to=='D')
        {converted=amt*euro;
        printf("%.2f euros are equivalent to %.2f dollars. ",amt,converted);
        }
    else if(to=='P')
        {converted=amt*euro/pound;
        converted*=
        printf("%.2f euros are equivalent to %.2f pounds. ",amt,converted);
        }
    else
        printf("invalid to currency ");
        }
else if(from=='P')
       {if(to=='E')
        {converted=amt*pound/euro;
        printf("%.2f pounds are equivalent to %.2f euros. ",amt,converted);
        }
    else if(to=='D')
        {converted=amt*pound;
        printf("%.2f pounds are equivalent to %.2f dollars. ",amt,converted);
        }
    else
        printf("invalid to currency ");
        }
else
    printf("invalid from currency ");
getch();
return 0;
}