Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following program generates an error. Why? #include #include using namespace std; class CurrencyConverter { public: string toCurrency; private: int amount; CurrencyConverter ConvMoney ( int

The following program generates an error. Why?
#include
#include
using namespace std;
class CurrencyConverter {
public:
string toCurrency;
private:
int amount;
CurrencyConverter ConvMoney(int amt, string toCurr);
};
CurrencyConverter CurrencyConverter::ConvMoney(int amt, string toCurr){
CurrencyConverter myMoney;
if (toCurr == "Euro"){
myMoney.amount = amt *.89;
}
else if (toCurr == "Yen"){
myMoney.amount = amt *108.67;
}
return myMoney;
}
int main(){
int amountIn;
string strCurr;
CurrencyConverter newMoney;
cout << "Enter the amount to convert and currency:";
cin >> amountIn;
cin >> strCurr;
newMoney = newMoney.ConvMoney(amountIn, strCurr);
return 0;
}
Group of answer choices
The object newMoney should be created using a vector.
The function ConvMoney should be made public to call it in main.
The class should be made in separate files.
Only the amount should be passed as an argument to the function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Query Formulation And Administration Using Oracle And PostgreSQL

Authors: Michael Mannino

8th Edition

1948426951, 978-1948426954

More Books

Students also viewed these Databases questions

Question

How to find if any no. is divisble by 4 or not ?

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago