1. Engineering
  2. Computer Science
  3. c error usersjeonjiwanclionprojectscis27maincpp7328 error type convert does not provide a...

Question: c error usersjeonjiwanclionprojectscis27maincpp7328 error type convert does not provide a...

Question details

[c++ Error]

/Users/jeonjiwan/CLionProjects/CIS27/main.cpp:73:28: error: type 'Convert' does not provide a call operator
cout <<cv(money).getConvertYen();
^~
/Users/jeonjiwan/CLionProjects/CIS27/main.cpp:76:28: error: type 'Convert' does not provide a call operator
cout <<cv(money).getConvertEuro();
^~
/Users/jeonjiwan/CLionProjects/CIS27/main.cpp:79:28: error: type 'Convert' does not provide a call operator
cout <<cv(money).getConvertPeso();
^~

#include <iostream>

using namespace std;

class Convert
{
    public:
        double currentMoney;
        double resultMoney;

        // double currentMoney, resultMoney;

    private:

        void setConvertYen(double currentMoney)
        {
            resultMoney = 1.4  * currentMoney;
        }

        double getConvertYen()
        {
            return resultMoney;
        }

        void setConvertEuro(double currentMoney)
        {
            resultMoney = 1.5 * currentMoney;
        }

        double getConvertEuro()
        {
            return resultMoney;
        }

        void setConvertPeso(double currentMoney)
        {
            resultMoney = 1.7 * currentMoney;
        }

        double getConvertPeso()
        {
            return resultMoney;
        }
};



int main()
{
    int choice;
    double money;

    Convert cv;
    //cv = Convert(money);



    do
    {
        cout << "Input your current money statement";
        cin >> money;

        cout << "Chose one of them\n";
        cout << "1. Dollar to Yen\n";
        cout << "2. Dollar to Euro\n";
        cout << "3. Dollar to Peso\n";
        cout << "4. Close the Program\n";
        cin >> choice;

            switch (choice)
            {
                case 1:
                    cout <<cv(money).getConvertYen();

                case 2:
                    cout <<cv(money).getConvertEuro();

                case 3:
                    cout <<cv(money).getConvertPeso();

                case 4:
                    cout <<"Terminate Program";
            }
    }while(choice != 4);





}
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution