Concept explainers
Order Status
The Middletown Wholesale Copper Wire Company sells spools of copper wiring for $100 each and ships them for $10 apiece. Write a program that displays the status of an order. It should use two functions. The first function asks for the following data and stores the input values in reference parameters.
• The number of spools ordered.
• The number of spools in stock.
• Any special shipping and handling charges (above the regular $10 rate).
The second function receives as arguments any values needed to compute and display the following information:
• The number of ordered spools ready to ship from current stock.
• The number of ordered spools on backorder (if the number ordered is greater than what is in stock).
• Total selling price of the portion ready to ship (the number of spools ready to ship times $100).
•Total shipping and handling charges on the portion ready to ship.
• Total of the order ready to ship.
The shipping and handling parameter in the second function should have the default argument 10.00.
Want to see the full answer?
Check out a sample textbook solutionChapter 6 Solutions
Starting Out with C++: Early Objects (9th Edition)
Additional Engineering Textbook Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
SURVEY OF OPERATING SYSTEMS
Starting Out with Python (4th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
- pythonarrow_forwardSalaryStmt.py Write a python program that accepts name of an employee and employee's yearly sales of last five years. The data should be collected for n employees. The value of n should also be accepted as input. All amounts should be displayed with three decimal places. The output should be displayed as a table containing the Employee name, Average Sales and Bonus. The program must define and use a function with Total Sales as a parameter and should calculate the Average Sales and Bonus for cach employee. Bonus must be calculated based on the following table: Average Sales (AS) AS<5000 50002AS<7500 75002AS<10000 AS210000 Bonus | 1% of Average Sales 2% of Average Sales 4% of Average Sales 7% of Average Sales Sample Output ====: Employee Name Average Sales Bonus === AFRAH 8577.000 343.080 ASMA 6476.800 129.536 4943.000 10260.000 ATHEER 49.430 718.200 315.064 135.608 352.888 365.072 305.240 НАЈАR HAJAR 7876.600 6780.400 8822.200 9126.800 7631.000 7580.400 MALLAK MARYAM NOORA SAHAR SHEFAA…arrow_forwardQuestion6 - A number is called a Disarium when the sum of its digits in their respective order is the number itself. Create a function that determines whether a number is a Disarium or not. (In python) Examples is_disarium (75) → False # 7^1+ 5 ^ 2 = 7 + 25 = 32 is_disarium (135)· # 1^1+ 3 ^ 2 + 5 ^3 = 1+ 9 + 125 = 135 - True is_disarium (544) - False is_disarium (518) - True is_disarium (466) - False is_disarium (8) - Truearrow_forward
- Phython: Create a function so that when giving you a month it tells you the season of that month, for example: if it is January it will be winter.Using the def, try and except ValueError functions.arrow_forwardCoin Toss Write a function named coinToss that simulates the tossing of a coin. When you call the function, it should generate a random number in the range of 1 through 2. If the random number is 1, the function should display "heads". If the random number is 2, the function should display "tails". Demonstrate the function in a program that sks the user how many times the coin should be tossed and the coin then simulates the tossing of the coin that number of times.arrow_forwardInstructions Write a function create_password() expects two parameters: pet_name (a string) and fav_number (an integer). The function returns a new password generated using the following pattern: fav_number followed by the pet_name followed by the star * and fav_number again (see the example below). Create a program that gets a pet name and a favorite number as input from the user, calls the above function, and then prints the output as shown below. Example Input: Angel 3 Output: Your new password is "3Angel*3". Note that the double quotes are part of the output. The assert in the provided template is checking that this function call is returning the correct value (i.e., a correctly-formed string). assert create_password("Angel", 3) == "3Angel*3" Hints Remember that you cannot directly concatenate an integer and a string - you need to convert an integer into a string using either str() or by using f-strings. Troubleshooting If you are getting AssertionError make sure that your…arrow_forward
- PAYTHON CODEarrow_forwardFizzBuzz Interview Question Create a function that takes a number as an argument and returns "Fizz", "Buzz" or "FizzBuzz". If the number is a multiple of 3 the output should be "Fizz". If the number given is a multiple of 5, the output should be "Buzz". If the number given is a multiple of both 3 and 5, the output should be "FizzBuzz". If the number is not a multiple of either 3 or 5, the number should be output on its own as shown in the examples below. The output should always be a string even if it is not a multiple of 3 or 5. Examples fizz_buzz (3) "Fizz" fizz_buzz (5) → "Buzz fizz_buzz (15) "FizzBuzz" fizz_buzz (4) "4" 11arrow_forwardWrite a split_check function that returns the amount that each diner must pay to cover the cost of the meal. The function has four parameters: . bill: The amount of the bill. people: The number of diners to split the bill between. tax_percentage: The extra tax percentage to add to the bill. tip_percentage: The extra tip percentage to add to the bill. ● ● The tax or tip percentages are optional and may not be given when calling split_check. Use default parameter values of 0.15 (15%) for tip_percentage, and 0.09 (9%) for tax_percentage. Assume that the tip is calculated from the amount of the bill before tax. Sample output with inputs: 25 2 Cost per diner: $15.50 Sample output with inputs: 100 2 0.075 0.21 Cost per diner: $64.25 Learn how our autograder works 461710.3116374.qx3zqy7 1 # FIXME: Write the split_check function. HINT: Calculate the amount of tip and tax, 2 # add to the bill total, then divide by the number of diners. 3 4 Your solution goes here''' 5 6 bill float(input()) 7…arrow_forward
- printTodaysDate is a function that accepts no parameters and returns no value. Write a statement that calls printTodaysDate.arrow_forwardFuture Investment Value = investment amount * (1 + monthly interest)^(number of years * 12) Using this formula, write a function in Python called futureValue that prompts the user to enter an investment amount, an annual percentage interest rate, and the amount of years. The function should accept the input as arguments. The interest rate should have a default value of 7%. You can add default values of your choice for the amount of years. This function should print out a table that displays the future values. Demonstrate this function in another function called main. Format your output by two decimal places. Output Example: Enter the amount you want to invest: 1000 [Enter] Enter the interest rate for your investment: [Enter] Enter the number of years you want to invest this money: 30 [Enter] Years Future Value 1 1093.81 2 1196.41 ........ 30 14730.58arrow_forward//The function must return the value indicated in the comments // The calcDiscountPrice function accepts an item's price and // the discount percentage as arguments. It uses those // values to calculate and return the discounted price. Function Real calcDiscountPrice (Realsprice, Real percentage) // Calculate the discount. Declare Real discount = price * percentage // Subtract the discount from the price. Declare Real discountPrice = price discount // Return the discount price. Return End Functionarrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning