Program
#12
C++
K. Dzwonkiewicz
Calculate the fare for airplane tickets on the airline
“Friendly Skies”
· Ask
for name
· Ask
passenger’s age
|
"If
toast always lands butter-side down, and cats always land on their feet, what
happens if you strap toast on the back of a cat and drop it?" |
· Ask
destination
· Ask
sex
· Ask if special discounts
apply
Fee is calculated as such…
Mileage: 1-250 miles .25/mile
251-500 miles .15/miles
501-any higher miles .12/miles
These are the only destinations: Chicago (the windy city) 275 miles
New York (the big apple) 525 miles
Philadelphia (city of brotherly love) 405 miles
Los Angeles (city of angels) 2575 miles
Cleveland (mistake on the lake) 185 miles
Cincinnati (the queen city) 305 miles
Base ticket prices by age: 1-12 $50
13-20 $75
21-120 $100
Discounts: Military 30% off total ticket fare
Clergy 10% off total ticket fare
Student 25% off total ticket fare
Sample run…
Name:Steve "I'm desperately trying to
figure out why kamikaze pilots wore helmets."
Dave Edison.
Age:16
Sex(m or f):m
Destination: 1)Chicago 2)New York 3)Philadelphia 4)Los Angeles
5)Cleveland 6)Cincinnati
Please select your destination (enter the number):2
Discount: 1)Military 2)Clergy 3)Student 4)None
Please select dicount (if applies):3
Please pay this amount: $103.50 includes discount of $34.50
Thank you Steve for flying the semi-friendly skies!
Your program will ask all the questions in main
Call a function, call it Get_basefare, where you return base ticket (send in age)
Call a function, call it Get_milecharge, where you return mileage cost (send in miles)
Use a series of if statements based on destination choice…if(ch==1) miles=275
Call a function, call it Get_disc, where you send in grossfare and discount_ch. Return
Discount_amt…(maby returns a zero).
You could make this with some nested (composite functions) but use the KISS technique
Hand in list and two sample runs.
"Did
you ever walk in a room and forget why you walked in? I think that's how dogs
spend their lives."
Sue Murphy.