Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with this python code! It needs to be done in the most simple way possible, I'm having trouble figuring out how to complete

Please help with this python code! It needs to be done in the most simple way possible, I'm having trouble figuring out how to complete this lab, please help!

image text in transcribedimage text in transcribedimage text in transcribed

Program Specifications In this lab, you are asked to compare two credit card offers and provide a recommendation based on how many award dollars each credit card will reward. For every dollar you spend using a particular credit card, you can get a certain number of points. These points can then be converted back into dollars in the form of award dollars. Typically one award dollar can be rewarded for each 100 points. But there are many different credit cards out there with many different types of offers. The program for this lab should ask the user for an estimated monthly expenses. That is, how much the user is planning to spend monthly on the card. The program should then ask for the offer details of two credit cards. Based on this information, the program should calculate the annual award dollars each credit card will reward and provide a recommendation on which credit card is better. Note that some credit card offers include an annual fee. The calculation of award dollars that is rewarded must take into account the annual fee that must be paid. Sample runs In this sample run, the user input is 2000 for the estimated monthly expenses. Then for the first card, the annual fee is 90 and the points per dollar spent is 2. For the second card, the annual fee is 0 and the points per dollar spent is 1.25. This program compares two credit card offers to determine the best credit card in terms of award dollars. Enter estimated monthly expenses: 2000 === Credit Card 1 Offer === Enter annual fee: 90 Enter points per dollar spent: 2 === Credit Card 2 Offer === Enter annual fee: 0 Enter points per dollar spent: 1.25 Credit Card 1 annual award dollars is $390.00. Credit Card 2 annual award dollars is $300.00. We recommend applying for Credit Card 1. An estimated monthly expenses of $2,000 would mean annual expenses of $24,000. For the first card, the annual total points would then be 48,000 points (two points per dollar spent). Since 100 points can be traded for one award dollar, the annual award dollars would be $480. However, the first card includes an annual fee of $90, which means the net annual award dollars would be $390. For the second card, the annual total points would be 30,000 points (two points per dollar spent). Again, since 100 points can be traded for one award dollar, the annual award dollars would be $300. The second card doesn't have an annual fee, so the award dollars would be the full $300. Since the annual award dollars of the first credit card is higher than the annual award dollars of the second credit card, the program recommends the user to apply for the first credit card. Required program decomposition You are required to include the following functions in your program. The names of your functions must be identical to the function names listed below. However, the names of the parameters do not have to be exactly the same as those listed below. print_intro) This function prints the program introduction (see sample run). There should be an additional empty line after the program introduction, which is not shown below. This program compares two credit card offers to determine the best credit card in terms of award dollars. get_award_dollars (monthly_expenses, annual_fee, points_per_dollar) This function accepts three parameters: 1) the user's monthly expenses, 2) the annual fee of a credit card, and 3) the points per dollar spent offered by a credit card. The function should calculate the total annual award dollars based on the information from the parameters. The function should then return this calculated value. process_card (num, monthly expenses) This function accepts two parameters: 1) a number (which will be 1 or 2), and 2) the user's monthly expenses. Notice that the name of the function, process_card, is singular. This means that a call to this function will only process a single card's information. The function should do the following tasks: Print the heading for the credit card offer, "=== Credit Card 1 Offer ===" if num is 1 and "=== Credit Card 2 Offer ===" if num is 2. Ask the user for the annual fee of the credit card. Ask the user for the points per dollar spent. There should be an additional empty line after getting the input from the user. Return the annual award dollars for the credit card. This will require a call to another function. Notice that this function prints to the screen and returns a value. In the sample run, one part that this function should print is given below, where the input values are 90 and 2 === Credit Card i Offer === Enter annual fee: 90 Enter points per dollar spent: 2 print_recommendation(award_dollars_1, award_dollars_2) This function accepts two parameters: 1) the annual award dollars of the first credit card, and 2) the annual award dollars of the second credit card. The function should print a summary of the award dollars each credit card will reward and a recommendation on which credit card the user should apply for. In the sample run, the part that this function should print is given below. Credit Card 1 annual award dollars is $390.00. Credit Card 2 annual award dollars is $300.00. We recommend applying for Credit Card 1. Notes Asking the user for the estimated monthly expenses should be done in the main function. The functions that should be called from the main functions are: print_intro, process_card, and print_recommendation. All dollar values should include two decimal digits. Annual award dollar values cannot be negative. The lowest value of annual award dollars is zero. If the annual award dollars are equal, print the following for the recommendation: "Both cards result in the same total award dollars." All your statements must be part of one of the functions described above (including the main function). Style guidelines Be sure you are following to the programming style guidelines as outlined in the CS 1104 Style Guide document, which can be found on Brightspace under Content Course Documents. Note on Spyder For at least the Windows version of Spyder, an extra empty line is printed before every call to the input function, whereas in zyBook or other Python IDEs, the empty line isn't supposed to be there. This bug has been noted to the developers of Spyder, but has not been resolved. For example, the code: print('A line.') input('A prompt: ') will output in Spyder: A line. A prompt: Notice the extra empty line in the middle. The correct output should have been: A line A prompt: Please note this buggy behavior on Spyder and write your code as if the line was not there i.e., in the example two-line code above, there won't be an extra line in- between the outputs)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions