Question
An airline describes airfare as follows. A normal ticket's base cost is $500. Persons aged 65 or over have a base cost of $450. Children
An airline describes airfare as follows. A normal ticket's base cost is $500. Persons aged 65 or over have a base cost of $450. Children 3 or under have $0 base cost. A single carry-on bag costs $0, but a second carry-on is $10. The first two checked bags are free, the third is $50, and each additional is $75. Given inputs of age, carry-on (0, 1, or 2), and checked bags (0 or greater), compute the total airfare. Hints: First use an if-else statements to assign airFare with the base cost Use another if statement to update airFare for a carryOn Finally, use another if-else statement to update airFare for checked bags Think carefully about what expression correctly calculates checked bag cost when bags are 3 or more
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started