program fly2; uses crt; {-------------------------------------------------------------------------- This program will compute the price the user must pay for an airline ticket to a place a given number of miles away. There are discounts for age and large amounts of traveling. by --------------------------------------------------------------------------} VAR age,miles:integer; price1,price2,dis,ppm:real; begin clrscr; writeln; writeln; textcolor(green); writeln (' PRICE CHART'); writeln ('Children 12 and under: 50% off'); writeln ('Teens age 13 to 17: 25% off'); writeln ('Adults: Full Fare $0.15 per mile'); writeln ('Seniors 55 and over: 30% off'); writeln; writeln ('Price per mile of travel:'); writeln ('under 500 miles: $0.17'); writeln ('500 to 1000 miles: $0.14'); writeln ('1000 to 2000 miles: $0.12'); writeln ('over 2000 miles: $0.10'); writeln; writeln; write ('Hello. How old are you? ---> '); readln(age); writeln; write ('How far do you want to fly (in miles)? ---> '); readln(miles); case age of 0..12 : dis := 0.50; 13..17 : dis := 0.25; 18..54 : dis := 0; 55..135 : dis := 0.30; end; case miles of 0..500 : ppm := 0.17; 500..1000 : ppm := 0.14; 1000..2000 : ppm := 0.12; else ppm := 0.10; end; price1 := miles * ppm ; writeln; writeln; textcolor(red); writeln ('Price before the discount: $',price1:0:2); price2 := price1 * dis; dis := dis * 100; writeln; writeln ('Your discount of ',dis:0:0,'%: $',price2:0:2); price1 := price1 - price2; writeln; writeln ('Your final price: $',price1:0:2); readln; end.