Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- class flight
- {
- private:
- int Flight_number;
- string Destination;
- float Distance;
- float MaxFuelCapacity;
- void CalFuel()
- {
- if(Distance<=1000)
- MaxFuelCapacity=500;
- else if(Distance>1000&&Distance<=2000)
- MaxFuelCapacity=1100;
- else if(Distance>2000)
- MaxFuelCapacity=2200;
- }
- public:
- void FeedInfo(int fn,string des,float dis)
- {
- Flight_number=fn;
- Destination=des;
- Distance=dis;
- CalFuel();
- }
- void ShowInfo()
- {
- cout<< "flight number: "<< Flight_number <<endl;
- cout<< "destination: "<< Destination <<endl;
- cout<< "distance: "<< Distance <<endl;
- cout<< "Max fuel capacity: "<< MaxFuelCapacity <<endl;
- }
- };
- int main()
- {
- flight f1;
- f1.FeedInfo(10,"USA",2500.0);
- f1.ShowInfo();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement