#include <iostream>
#include <string>
using namespace std;
class AutoTaxi {
private:
string car_number;
int location;
string mode;
public:
AutoTaxi(string car_number, int location = 0, string mode = "Normal") {
this->car_number = car_number;
this->location = location;
this->mode = mode;
}
int calculate_fare(int distance) {
int fare = 4000;
if (distance > 2000) {
int extra_distance = distance - 2000;
fare += (extra_distance / 132) * 100;
}
if (mode == "Night") {
fare = static_cast<int>(fare * 1.2);
}
return fare;
}
void switch_mode() {
if (mode == "Normal") {
mode = "Night";
} else {
mode = "Normal";
}
}
};
int main() {
AutoTaxi taxi("123가4567", 0, "Normal");
int distance = 5000;
taxi.switch_mode();
int fare = taxi.calculate_fare(distance);
cout << fare << endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: