Convert below code in C++ class Arrival { String flightId,location,arrivalTime; int fuel,landTime,waitingTime; Arrival(String flightId ,int fuel,String location,String arrivalTime) { this.flightId=flightId; this.fuel=fuel; this.location=location; this.arrivalTime=arrivalTime; } public void setFuel(int fuel) { this.fuel=fuel; } public void setWaitingTime(int time) { this.waitingTime=time; } public String toString() { return String.format("Flight user_id: %s , Flight Fuel:%d Gallon , Flight location: %s , Flight Arrival Time : %s , Waiting time %d Minutes",flightId,fuel,location,arrivalTime,waitingTime); } } class Departure { String flightId; String location; int flightStatus; String depTime; int waitingTime; Departure(String flightid , String location , int flightStatus,String depTime) { this.flightId=flightid; this.location=location; this.flightStatus=flightStatus; this.depTime=depTime; } public void setWaitingTime(int time) { this.waitingTime=time; } public String toString() { return String.format("Flight Id: %s , Flight Status : Cancelled , Flight location: %s , Flight Departure Time : %s , Waiting time %d Minutes",flightId,location,depTime,waitingTime); } }
Convert below code in C++
class Arrival
{
String flightId,location,arrivalTime;
int fuel,landTime,waitingTime;
Arrival(String flightId ,int fuel,String location,String arrivalTime)
{
this.flightId=flightId;
this.fuel=fuel;
this.location=location;
this.arrivalTime=arrivalTime;
}
public void setFuel(int fuel)
{
this.fuel=fuel;
}
public void setWaitingTime(int time)
{
this.waitingTime=time;
}
public String toString()
{
return String.format("Flight user_id: %s , Flight Fuel:%d Gallon , Flight location: %s , Flight Arrival Time : %s , Waiting time %d Minutes",flightId,fuel,location,arrivalTime,waitingTime);
}
}
class Departure
{
String flightId;
String location;
int flightStatus;
String depTime;
int waitingTime;
Departure(String flightid , String location , int flightStatus,String depTime)
{
this.flightId=flightid;
this.location=location;
this.flightStatus=flightStatus;
this.depTime=depTime;
}
public void setWaitingTime(int time)
{
this.waitingTime=time;
}
public String toString()
{
return String.format("Flight Id: %s , Flight Status : Cancelled , Flight location: %s , Flight Departure Time : %s , Waiting time %d Minutes",flightId,location,depTime,waitingTime);
}
}
Step by step
Solved in 2 steps