(Use Python) Use the Design Recipe to write a function called compute_commission that returns the commission earned by a salesperson for the sale of a car. The function should consume two parameters, first a string representing the model of the car sold and the second an int representing the number of extra features that were sold. The commission follows these rules: The commission earned on a basic model (“basic”) is $1000, on a mid-range model (“mid”) is $1500 and on a luxury model (“luxury”) is $2000. You may assume that these are the only three string values that will be passed to your function. The salesperson earns $100 per extra feature sold. You may assume the value for the extra features is always greater than or equal to zero. Include a docstring!

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter3: Assignment, Formatting, And Interactive Input
Section3.3: Using Mathematical Library Functions
Problem 1E
icon
Related questions
Question

(Use Python) Use the Design Recipe to write a function called compute_commission that returns the commission earned by a salesperson for the sale of a car. The function should consume two parameters, first a string representing the model of the car sold and the second an int representing the number of extra features that were sold. The commission follows these rules:

  • The commission earned on a basic model (“basic”) is $1000, on a mid-range model (“mid”) is $1500 and on a luxury model (“luxury”) is $2000. You may assume that these are the only three string values that will be passed to your function.
  • The salesperson earns $100 per extra feature sold. You may assume the value for the extra features is always greater than or equal to zero.

Include a docstring!

Write 3 assert_equal statements to test your function.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning