(25 min) The following table shows the foreign exchange rates for a few currencies. Foreign Currency 1 Dollar RM USD (D) 4.16 GBP (P) 1 Pound 5.68 KRW (W) 1000 Won 3.51 JPY (Y) 100 Yen 3.69 Develop a complete C++ program that will prompt the user to enter the currency preferred and the amount required. The program should include a function with the following prototype: double CurrencyBuy(char, double): The first parameter in the function prototype is for the type of currency where the characters D, P, W and Y represent Dollar, Pound, Won and Yen respectively. The second parameter is the amount to be bought. This function CurrencyBuy should return, to the calling function, the payment to be paid in RM. A sample of the output is given as follows. Foreign Exchange Currency Country Code USD (D) GВР (Р) KRW (W) JPY (Y) Enter the country code: D Enter the amount to be bought: 300 Payment due is RM 1248.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 1TF
icon
Related questions
Question
100%
(25 min) The following table shows the foreign exchange rates for a few currencies.
Foreign Currency
RM
USD (D)
1 Dollar
4.16
GBP (P)
1 Pound
5.68
KRW (W)
1000 Won
3.51
JPY (Y)
100 Yen
3.69
Develop a complete C++ program that will prompt the user to enter the currency preferred and the amount required. The
program should include a function with the following prototype:
double CurrencyBuy(char, double):
The first parameter in the function prototype is for the type of currency where the characters D, P, W and Y represent
Dollar, Pound, Won and Yen respectively. The second parameter is the amount to be bought. This function CurrencyBuy
should return, to the calling function, the payment to be paid in RM.
A sample of the output is given as follows.
Foreign Exchange Currency
Country Code
USD (D)
GВР (Р)
KRW (W)
JPY (Y)
Enter the country code: D
Enter the amount to be bought: 300
Payment due is RM 1248.
Transcribed Image Text:(25 min) The following table shows the foreign exchange rates for a few currencies. Foreign Currency RM USD (D) 1 Dollar 4.16 GBP (P) 1 Pound 5.68 KRW (W) 1000 Won 3.51 JPY (Y) 100 Yen 3.69 Develop a complete C++ program that will prompt the user to enter the currency preferred and the amount required. The program should include a function with the following prototype: double CurrencyBuy(char, double): The first parameter in the function prototype is for the type of currency where the characters D, P, W and Y represent Dollar, Pound, Won and Yen respectively. The second parameter is the amount to be bought. This function CurrencyBuy should return, to the calling function, the payment to be paid in RM. A sample of the output is given as follows. Foreign Exchange Currency Country Code USD (D) GВР (Р) KRW (W) JPY (Y) Enter the country code: D Enter the amount to be bought: 300 Payment due is RM 1248.
Expert Solution
steps

Step by step

Solved in 4 steps with 7 images

Blurred answer
Knowledge Booster
Algebraic Expression
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr