Write a function textbook_cost that has 3 parameters, full price of the textbook, rent/purchase indicator (1 - for purchase and 2 - for rent), and the duration of the course (in weeks). The function returns the cost of the textbook.
Write a program that reads book price, duration of the course (in weeks),
and student choice to rent or purchase for 3
courses.
The program finds the price for each book,
the TOTAL cost of all textbooks, and an AVERAGE
price per textbook.
Example: Suppose the full prices of the books are $49.99, $99.99 and $14.59, duration of the courses in weeks:
14, 7, 7, and the student choice to rent or purchase: 2, 2, 1.
Output:
book1 cost = 70, book2 cost = 35, book3 cost = 14.59
TOTAL = 119.59
AVERAGE = 39.86