Question
[C++] EconomicsAnalysis class The attributes of the class will be a GDP object and a UNEMP object. It should have a constructor that receives the
[C++]
EconomicsAnalysis class
The attributes of the class will be a GDP object and a UNEMP object.
It should have a constructor that receives the two file names, passing each to the read method of the GDP and UNEMP classes.
So if my two classes, GDP and UEMP, are already defined, how do I pass them in the constructor of EconomicAnalysis class and call them in main.cpp?
Header:
#ifndef ECONOMICSANALYSIS_H_INCLUDED #define ECONOMICSANALYSIS_H_INCLUDED #include "UNEMP.h" #include "GDP.h" #include
typedef struct fileData3{ GDP gdp; UNEMP unemployment; }structData2;
class EconomicsAnalysis{ public: EconomicsAnalysis(string filename, string filename2); };
#endif // ECONOMICSANALYSIS_H_INCLUDED
#include "EconomicsAnalysis.h" #include
EconomicsAnalysis::EconomicsAnalysis(string filename, string filename2){ int choice; cout << "Enter '1' to search years or '2' to view stored data. Press 0 to quit." << endl; cin >> choice; while(choice!=0){ if(choice == 1){ cout << "Economic Analysis:" << endl; GDP gdp; gdp.get(filename); UNEMP unemployment; unemployment.get(filename2); } else if(choice ==2){ cout << "Stored Data: " << endl; GDP gdp; UNEMP unemployment; gdp.show(); unemployment.show(); } else { choice; } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started