Test 2 CSCI 151 Version 1

Question 1 (25 points): a. Give an example of the input to print python 3 times. EXPLAIN YOUR ANSWER.

n = int(input("enter n "))
i = 4
while(i <= n): b. Give an example of the input to print 9. EXPLAIN YOUR ANSWER.

n = int(input("enter n "))
i = 2
sum = 0
while(i <= n):
print(sum)

Question 2 (75 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. For Business Class Ticket, customers earn 12 points per dollar and for Coach Class Ticket customers earn 10 points per dollar. For example, if the business ticket cost $220, customer will earn 12*220 = 2640 points for that flight.

Assuming, the customer bougth two tickets in specific year, write a program that reads the ticket price for each flight and the fare indicator for each flight, the integer 1 or 2, where 1 indicates business fare and 2 coach fare. The program prints the total number of points customer earned during the year.

In addition, the program will determine if the customer is eligible for free domestic flight or free international flight. Use the following rule: free international flight cost 7000 points and free domestic flight cost 3500 points.

Optional: use loop WHILE