I have to create a program that will convert exchange rates. I\'m having trouble
ID: 3623126 • Letter: I
Question
I have to create a program that will convert exchange rates. I'm having trouble figuring how to do this. I have added the exact question out of my text.Q:It is often hard to compare the value of two items if they are priced in different currencies. Write a program that will allow a user to enter of a purchase in U.S. dollars, Australian dollars, Euros, or U.K. pounds, and then convert the cost to any of the other currencies, as specified by the user. Use the following conversion factors in your program:
A$1.00=US$0.74
Euro1.0=US$1.21
UKpound1.00=US$1.78
Explanation / Answer
please rate - thanks
I'm sorry I don't know the math to do all the conversions I believe all the to U.S. dollars is correct, because you provided the numbers, you'll have to change the other formulas
real amt,newamt
integer buy,convert
write(*,*)"Enter the purchase currency"
buy=typemoney()
write(*,*)"Enter the conversion currency"
convert=typemoney()
write(*,*)"Enter the purchase price"
read(*,*)amt
if(convert .eq. 1)then
if(buy .eq. 2)then
newamt=amt*.74
endif
if(buy.eq.3)then
newamt=amt*1.21
endif
if(buy.eq.4)then
newamt=amt*1.78
endif
else if(convert .eq.2)then
if(buy .eq. 1)then
newamt=amt*.74
endif
if(buy.eq.3)then
newamt=amt*1.21
endif
if(buy.eq.4)then
newamt=amt*1.78
endif
else if(convert .eq.3)then
if(buy .eq. 1)then
newamt=amt*.74
endif
if(buy.eq.2)then
newamt=amt*1.21
endif
if(buy.eq.4)then
newamt=amt*1.78
endif
else
if(buy .eq. 1)then
newamt=amt*.74
endif
if(buy.eq.2)then
newamt=amt*1.21
endif
if(buy.eq.3)then
newamt=amt*1.78
endif
endif
write(*,*)"the converted price is ",newamt
CONTAINS
integer function typemoney()
write(*,*)"Enter type of money"
write(*,*)"1. U.S. dollars"
write(*,*)"2. Australian dollars"
write(*,*)"3. Euros"
write(*,*)"4. U.K. pounds"
read(*,*)typemoney
end function
end program