1. Engineering
  2. Computer Science
  3. c programming a little tiny error include ltiostreamgt using namespace...

Question: c programming a little tiny error include ltiostreamgt using namespace...

Question details

c++ programming a little tiny error

#include <iostream>

using namespace std;

class Convert
{
    private:
        double currentMoney;
        double resultMoney;


        // double currentMoney, resultMoney;

    public:
        Convert()
        {}
        Convert(double currentMoney)
        {
            this -> currentMoney = currentMoney;
        }
        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);



    return 0;

}

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

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