Week 8 Lab Wed

Session A: Lab Assignment

Problem 1 (100 points): The frequent flyer rewards program allows customer to earn points for every dollar spent on the flight ticket and then use rewards points for future ticket purchases. The amount and type of fare customer chooses determines how many points customer earns. For Business Fare, customers earn 12 points per dollar and for Coach Fare customers earn 10 points per dollar. For example, if the business fare ticket cost $220, customer will earn 12*220 = 2640 points for that flight.

Write a function flight_points that has two parameters: ticket_price and the fare_indicator (the integer 1 or 2, where 1 indicates business fare and 2 coach fare). The function returns the number of points customer earned for the flight.

Assume that the customer purchased 3 flights in one year. Write a program that reads ticket price (INTEGER) and flight indicator (INTEGER) for each flight. Use function flight_points to find the number of points customer earned for each flight, and then determine if the customer is eligible for free domestic flight or free international flight. Use the following rule: free international flight cost 60000 points and free domestic flight cost 35000 points.

The program MUST print the number of points for EACH flight, TOTAL number of points for three flights and the message indicating eligibility for free ticket. Assume that input is VALID

Example:
Input: 1500 1 2200 1 500 2
Output:
points for flight1: 18000
points for flight2: 26400
points for flight3: 5000
Total points:49400
Eligible for domestic free flight, NOT eligible for international free flight

Session B: Lab Practice