For the best experience, increase the window size or view on a laptop or desktop device
Title | ||
|---|---|---|
Loading... | ||
For the best experience, increase the window size or view on a laptop or desktop device
Title | ||
|---|---|---|
Loading... | ||
You're building a tool to estimate the cost of various airplane tickets based on the airline, distance and seating class. Your tool must take in this information as a series of inputs (one ticket calculation per line of input) and produce a list of output costs. Each airline contains its own cost requirements. Ultimately, the airline is only interested in two major components: the space you take on the plane, and the distance you fly. You must generate ticket costs using this gathered data:
Airlines: United, Delta, Southwest, LuigiAir Operating Costs:
Keep in mind that, while there are only four airlines listed above, your solution should be able to expand to dozens of individual airlines, whose ticket cost can be based on arbitrary functions of "Operating Costs", miles, and/or seating class. You can assume that the input will be provided as a list of strings and that there could be millions of lines of input. Each string will provide the Airline, Distance and Seating Class. Please review the examples below:
Example Input:
-------------------------------------------
United 150.0 Premium
Delta 60.0 Business
Southwest 1000.0 Economy
LuigiAir 50.0 Business
-------------------------------------------
Example Output:
-------------------------------------------
152.50
95.00
1000.00
125.00
-------------------------------------------
Explanation of Output:
-------------------------------------------
152.50 (150.0 * (0.75 + 0.10) + 25)
95.00 (60.0 * (0.50 + 0.25) + 50)
1000.00 (1000.0 * 1.00)
125.00 (100 <= 2 * (50 + 50 * 0.25))
-------------------------------------------
You're building a tool to estimate the cost of various airplane tickets based on the airline, distance and seating class. Your tool must take in this information as a series of inputs (one ticket calculation per line of input) and produce a list of output costs. Each airline contains its own cost requirements. Ultimately, the airline is only interested in two major components: the space you take on the plane, and the distance you fly. You must generate ticket costs using this gathered data:
Airlines: United, Delta, Southwest, LuigiAir Operating Costs:
Keep in mind that, while there are only four airlines listed above, your solution should be able to expand to dozens of individual airlines, whose ticket cost can be based on arbitrary functions of "Operating Costs", miles, and/or seating class. You can assume that the input will be provided as a list of strings and that there could be millions of lines of input. Each string will provide the Airline, Distance and Seating Class. Please review the examples below:
Example Input:
-------------------------------------------
United 150.0 Premium
Delta 60.0 Business
Southwest 1000.0 Economy
LuigiAir 50.0 Business
-------------------------------------------
Example Output:
-------------------------------------------
152.50
95.00
1000.00
125.00
-------------------------------------------
Explanation of Output:
-------------------------------------------
152.50 (150.0 * (0.75 + 0.10) + 25)
95.00 (60.0 * (0.50 + 0.25) + 50)
1000.00 (1000.0 * 1.00)
125.00 (100 <= 2 * (50 + 50 * 0.25))
-------------------------------------------
Output