Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1- Airplane An airplane model can be described (highly oversimplified) by the fo

ID: 3912330 • Letter: 1

Question

1- Airplane An airplane model can be described (highly oversimplified) by the following attributes name: String empty weight: double number of seats: int fuel Consumption: double a) Define a class AirplaneModel with the attributes defined above b) Your class should contain the following member functions: A default constructor that initializes the class's attributes. A constructor that sets the attributes. getName() to get the model's name getEmptyWeight() to get the model's empty weight getSeats() to get the number of seats getFuelConsumption() to get the fuel consumption setName() to set the model's name setEmptyWeight() to set the model's empty weight setSeats() to set the number of seats setFuelConsumption() to set the fuel consumption setSeats(int seats): to set the number of seats to an airplane AddSeats(int seats): to add seats to an airplane. of seats, and fuel Consumption. d) Call your class with a method main that constructs one airplane model and performs the following Initialize one airplane model. The airplane has 200 seats. Display the number of seats of the airplane Add 50 seats to the airplane Display the number of seats of the airplane. Display a report about the airplane

Explanation / Answer

#include <iostream>
using namespace std;
class Airplane
{
private:
int seat;
double weight, fuel;
string name;
public:
Airplane()
{
name = "";
weight = 2445.5;
fuel = 1000;
seat = 200;
}
Airplane(string nam, double wt, int st, double fl)
{
name = nam;
weight = wt;
seat = st;
fuel = fl;
}
void setName(string nam)
{
name = nam;
}
void setEmptyWeight(double wt)
{
weight = wt;
}
void setSeats(int st)
{
seat = st;
}
void setFuelConsumption(double fl)
{
fuel = fl;
}
string getName()
{
return name;
}
double getEmptyWeight()
{
return weight;
}
int getSeats()
{
return seat;
}
int getFuelConsumption()
{
return fuel;
}
void setSeats(double seats)
{
seat = seats;
}
int AddSeats(int seats)
{
return seat + 50;
}
};
int main()
{
int s;
Airplane Ap;
Ap.setName("ABC");
Ap.setEmptyWeight(1450.50);
Ap.setSeats(200);
Ap.setFuelConsumption(1500);
cout<<" Number of Seats of the airplane: " <<Ap.getSeats();
cout<<endl;
cout<<" Added 50 seats to the plane:" <<Ap.AddSeats(s);
cout<<endl;
cout<<" Report about the Airplane";
cout<<" *************************";
cout<<" Airplane Model: " <<Ap.getName();
cout<<" Airplane Empty Weight: " <<Ap.getEmptyWeight();
cout<<" Number of Seats: " <<Ap.AddSeats(s);
cout<<" Fuel Consumption: " <<Ap.getFuelConsumption();
return 0;
}

OUTPUT


Number of Seats of the airplane: 200

Added 50 seats to the plane:250

Report about the Airplane
*************************
Airplane Model: ABC
Airplane Empty Weight: 1450.5
Number of Seats: 250
Fuel Consumption: 1500