Question: Create a function file named PriceCalc that calculates the total price of an order of pens by doing the following: 1 . Takes an integer

Create a function file named PriceCalc that calculates the total price of an order of pens
by doing the following:
1. Takes an integer as an input and outputs the total price of the order by doing
(number of pens)*(price of each pen).
2. If the input is negative (ie. negative number of pens), print out a message The
number of pens is invalid and set the value for the price as -1.
1
3. If the input is between 1 and 20, the price of each pen is $4.99.
4. If the input is between 21 and 50, the price of each pen is $3.50.
5. If the input is larger than 50, print out a message Order too big. Contact
wholesaler and set the total price as -1.
Then, in the main script, use the function PriceCalc to find the cost to order -20 pens,
19 pens, 32 pens, and 124 pens

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!