write a program in c++ XYZ Airport has two currency exchange offices. ABC Conver
ID: 3906364 • Letter: W
Question
write a program in c++
XYZ Airport has two currency exchange offices. ABC Conversions services the north and east side of the airport while DEF Conversions services the south and the west side of the airport Notes You should have a minimum of 2 classes (you decide which elesses and how many) You decide which currencles are available for conversion Possible Sample Run 1 (your should have the same functionalityE program does not have to match the following exactly but Enter name of exchange office and manager: ABC Conversions Armin Enter name of exchange office and manager: DEF Conversions Jep cecoc Hello travelert Where are you in the airport? North Welcome to ABC Conversions. Please contact the manager Armin . What currency are you converting to dollars and how miuch? 200 yen Here you go s-/the smount n dollars shmuild he disglayed here (hased an youir calaulatioe) Hello travelert Where are you in the airport? West Welcome to DEr Conversions. Please contact the manager Jep if you have any complaints What currency are you coiverting to dollars and how much7 300 dinar We do not convert the dinar currency here. Sorry 06e Hello travelert Where are you in the airport? West Welcome to DEF Conversions. Please contact the manager lep if you have any complaints Here you go: nt in daillars chould be digayed r(hd on your What currency are you converting to dollars and how much? 300 peso Hello travelert Where are you in the airport?e SSITotal dallars given out 5-otal maunt ofExplanation / Answer
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
class CurrencyConverter{
public:
double convertCurrency(string type, double value){
if (type == "yen"){
return 0.0091 * value;
}
if (type == "peso"){
return 0.049 * value;
}
else {
return -1;
}
}
};
class Manager{
private:
string northoffice;
string northmanager;
string westoffice;
string westmanager;
public:
Manager(string no, string nm, string wo, string wm){
northoffice = no;
northmanager = nm;
westoffice = wo;
westmanager = wm;
}
void welcome(){
while(true) {
cout << "Hello traveller! Where are you in the airport? ";
string l;
cin >> l;
if (l == "exit")
break;
if (l == "North"){
cout << "Welcome to " << northoffice << endl;
cout << "Please contact manager " << northmanager << " in case of any issues ";
cout << "What is the currency you wnat to exchange and how much? ";
string cur;
double value;
cin >> cur >> value;
CurrencyConverter cc;
double m = cc.convertCurrency(cur,value);
if (m != -1){
cout << "Here you go $" << m << endl;
}
else {
cout << "No conversion possible ";
}
}
if (l == "West"){
cout << "Welcome to " << westoffice << endl;
cout << "Please contact manager " << westmanager << " in case of any issues ";
cout << "What is the currency you wnat to exchange and how much? ";
string cur;
double value;
cin >> cur >> value;
CurrencyConverter cc;
double m = cc.convertCurrency(cur,value);
if (m != -1){
cout << "Here you go $" << m << endl;
}
else {
cout << "No conversion possible ";
}
}
}
}
};
int main(){
cout << "Enter north office:";
string noffice;
cin >> noffice;
cout << "Enter north manager:";
string nmanager;
cin >> nmanager;
cout << "Enter west office:";
string woffice;
cin >> woffice;
cout << "Enter west manager:";
string wmanager;
cin >> wmanager;
Manager m(noffice, nmanager, woffice, wmanager);
m.welcome();
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.