Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- class FlightBooking {
- public:
- FlightBooking(int id, int capacity, double reserved);
- void printStatus();
- private:
- int id;
- int capacity;
- double reserved;
- };
- void FlightBooking::printStatus()
- {
- // print report here
- std::cout << id << std::endl;
- std::cout << capacity << std::endl;
- std::cout << reserved << std::endl;
- std::cout << "Flight: " << id << " : " << reserved << "/" << capacity << " " << ((reserved/capacity)*100) << "%" << std::endl;
- //"Flight [id] : [reserved]/[capacity] ([percentage]%)
- }
- FlightBooking::FlightBooking(int id, int capacity, double reserved)
- {
- this -> id = id;
- this -> capacity = capacity;
- this -> reserved = reserved;
- }
- int main() {
- double id;
- double reserved;
- double capacity;
- std::cout << "Provide flight id: ";
- std::cin >> id;
- std::cout << "Provide flight capacity: ";
- std::cin >> capacity;
- std::cout << "Provide number of reserved seats: ";
- std::cin >> reserved;
- FlightBooking booking(id, capacity, reserved);
- booking.printStatus();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement