Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 2.9, Problem 29CP
Write a Python statement that defines a named constant for a 10 percent discount.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Please develop a Python application that meets the requirements described below:
Project Description:
Scenario:
Write a program for a retail store that will allow them to calculate discounts for their employees when they buy items.
Discounts are based on the number of years worked (2% for each year, maximum 10%) as well as if the employee is a manager (10% more discount on top of the worked year discount) or hourly employee (2% discount). They are also allowed no discount once they have received $200 discount.
The program starts asking for the employee discount number to start purchasing. The employee can purchase 1 item at a time. Do this until the user answers “NO” for “Another purchase?”.
Once all employees have been processed, display the All-Employee Summary and give the users option to go back to Menu or Exit the program.
A workflow diagram is provided for each function to help visualize the flow through the program.
Actions:
Menu Pages:
Create the menus below using a…
In a C program, what does the following code do? x |= 1<<5;
Write a program in Python that reads the following information and prints a payroll statement:
Employee’s name (e.g., Smith)
Number of hours worked in a week (e.g., 10)
Hourly pay rate (e.g., 9.75)
Federal tax withholding rate (e.g., 20%)
State tax withholding rate (e.g., 9%)
A sample run is shown below:
Enter employee's name: Smith
Enter number of hours worked in a week: 10
Enter hourly pay rate: 9.75
Enter federal tax withholding rate: 0.20
Enter state tax withholding rate: 0.09
Employee Name: Smith
Hours Worked: 10.0
Pay Rate: $9.75
Gross Pay: $97.5
Deductions:
Federal Withholding (20.0%): $19.5
State Withholding (9.0%): $8.77
Total Deduction: $28.27
Net Pay: $69.22
Chapter 2 Solutions
Starting Out with Python (4th Edition)
Ch. 2.1 - Who is a programmers customer?Ch. 2.1 - What is a software requirement?Ch. 2.1 - What is an algorithm?Ch. 2.1 - What is pseudocode?Ch. 2.1 - Prob. 5CPCh. 2.1 - Prob. 6CPCh. 2.3 - Write a statement that displays your name.Ch. 2.3 - Write a statement that displays the following...Ch. 2.3 - Write a statement that displays the following...Ch. 2.5 - Prob. 10CP
Ch. 2.5 - Which of the following are illegal variable names...Ch. 2.5 - Prob. 12CPCh. 2.5 - Is the following assignment statement valid or...Ch. 2.5 - Prob. 14CPCh. 2.5 - Look at the following assignment statements:...Ch. 2.5 - What will be displayed by the following program?...Ch. 2.6 - You need the user of a program to enter a...Ch. 2.6 - Prob. 18CPCh. 2.7 - Prob. 19CPCh. 2.7 - Prob. 20CPCh. 2.7 - Prob. 21CPCh. 2.8 - How do you suppress the print functions ending...Ch. 2.8 - How can you change the character that is...Ch. 2.8 - Prob. 24CPCh. 2.8 - Prob. 25CPCh. 2.8 - What does the statement print (format (65.4321,...Ch. 2.8 - What does the statement print (format (987654.129,...Ch. 2.9 - What are three advantages of using named...Ch. 2.9 - Write a Python statement that defines a named...Ch. 2.10 - Prob. 30CPCh. 2.10 - Prob. 31CPCh. 2.10 - Prob. 32CPCh. 2.10 - Prob. 33CPCh. 2.10 - Prob. 34CPCh. 2.10 - Prob. 35CPCh. 2.10 - Prob. 36CPCh. 2.10 - Prob. 37CPCh. 2.10 - Prob. 38CPCh. 2.10 - Prob. 39CPCh. 2.10 - Prob. 40CPCh. 2.10 - Prob. 41CPCh. 2.10 - Prob. 42CPCh. 2.10 - Prob. 43CPCh. 2.10 - Prob. 44CPCh. 2.10 - Prob. 45CPCh. 2 - A ______ error does not prevent the program from...Ch. 2 - Prob. 2MCCh. 2 - A(n) __________ is a set of well-defined logical...Ch. 2 - An Informal language that has no syntax rules and...Ch. 2 - A _______ is a diagram that graphically depicts...Ch. 2 - A ______ is a sequence of characters. a. char...Ch. 2 - Prob. 7MCCh. 2 - Prob. 8MCCh. 2 - A string literal in Python must be enclosed in...Ch. 2 - Prob. 10MCCh. 2 - A(n) __________ makes a variable reference a value...Ch. 2 - This symbol marks the beginning of a comment in...Ch. 2 - Which of the following statements will cause an...Ch. 2 - In the expression 12 + 7, the values on the right...Ch. 2 - This operator performs integer division. a. // b....Ch. 2 - This is an operator that raises a number to a...Ch. 2 - This operator performs division, but instead of...Ch. 2 - Prob. 18MCCh. 2 - Which built-in function can be used to read input...Ch. 2 - Prob. 20MCCh. 2 - A magic number is _______. a. a number that is...Ch. 2 - A _______ is a name that represents a value that...Ch. 2 - Programmers must be careful not to make syntax...Ch. 2 - In a math expression, multiplication and division...Ch. 2 - Variable names can have spaces in them.Ch. 2 - In Python, the first character of a variable name...Ch. 2 - If you print a variable that has not been assigned...Ch. 2 - What does a professional programmer usually do...Ch. 2 - What is pseudocode?Ch. 2 - Computer programs typically perform what three...Ch. 2 - If a math expression adds a float to an int, what...Ch. 2 - What is the difference between floating-point...Ch. 2 - What is a magic number? Why are magic numbers...Ch. 2 - Assume a program uses the named constant PI to...Ch. 2 - Write Python code that prompts the user to enter...Ch. 2 - Write Python code that prompts the user to enter...Ch. 2 - Write assignment statements that perform the...Ch. 2 - Assume the variables result, w, x, y, and z are...Ch. 2 - Write a Python statement that assigns the sum of...Ch. 2 - Write a Python statement that subtracts the...Ch. 2 - Write a Python statement that multiplies the...Ch. 2 - Prob. 8AWCh. 2 - What would the following display? num = 99 num = 5...Ch. 2 - Assume the variable sales references a float...Ch. 2 - Assume the following statement has been executed:...Ch. 2 - What will the following statement display?...Ch. 2 - Write a turtle graphics statement that draws a...Ch. 2 - Write the turtle graphics statements to draw a...Ch. 2 - Write the turtle graphics statements to draw a...Ch. 2 - Personal Information Write a program that displays...Ch. 2 - Sales Prediction A company has determined that its...Ch. 2 - Land Calculation One acre of land is equivalent to...Ch. 2 - Total Purchase A customer in a store is purchasing...Ch. 2 - Distance Traveled Assuming there are no accidents...Ch. 2 - Sales Tax Write a program that will ask the user...Ch. 2 - Miles-per-Gallon A car's miles-per-gallon (MPG)...Ch. 2 - Tip, Tax, and Total Write a program that...Ch. 2 - Celsius to Fahrenheit Temperature Converter Write...Ch. 2 - Ingredient Adjuster A cookie recipe calls for the...Ch. 2 - Male and Female Percentages Write a program that...Ch. 2 - Stock Transaction Program Last month, Joe...Ch. 2 - Planting Grapevines A vineyard owner is planting...Ch. 2 - Compound Interest When a bank account pays...Ch. 2 - Turtle Graphics Drawings Use the turtle graphics...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write some code that asks the user to enter either of the words append or new. According to the user response, ...
Java: An Introduction to Problem Solving and Programming (8th Edition)
Big data Big data describes datasets with huge volumes that are beyond the ability of typical database manageme...
Management Information Systems: Managing The Digital Firm (16th Edition)
This optional Google account security feature sends you a message with a code that you must enter, in addition ...
SURVEY OF OPERATING SYSTEMS
Show a snippet of PHP code for creating a recordset. Explain the meaning of the code.
Database Concepts (8th Edition)
The solid steel shaft AC has a diameter of 25 mm and is supported by smooth bearings at D and E. It is coupled ...
Mechanics of Materials (10th Edition)
Summarize the steps involved when the Vole performs an instruction with op-code 0x5. Express your answer as a s...
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Knowledge Booster
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
- USING C++ PROGRAMMING LANGUAGE A mobile phone service has three different data plans for its customers: PLAN A: For $19.99 per month, 2 gigabytes are provided. Additional usage costs $8.00 per gigabyte. PLAN B: For $59.99 per month, 8 gigabytes are provided. Additional usage costs $8.00 per gigabyte. PLAN C: For $79.99 per month, Unlimited data is provided. Write a program that calculates a customer’s monthly bill. It should input the customer name, which plan was purchased, and how many gigabytes were used. It should then create a bill that includes the input information and the total amount due. It should also display how much money plan A customers would save if they purchased plan B or C, and how much money plan B customers would save if they purchased plan C. If there would be no savings, no message should be printed. Wherever possible, use named constants instead of numbers.arrow_forwardIn C++ Programming, write a program that calculates and prints the monthly paycheck for an employee. The net pay is calculated after taking the following deductions: Federal Income Tax: 15% State Tax: 3.5% Social Security Tax: 5.75% Medicare/Medicaid Tax: 2.75% Pension Plan: 5% Health Insurance: $75.00 Your program should prompt the user to input the gross amount and the employee name. The output will be stored in a file. Format your output to have two decimal places. A sample output follows: Bill Robinson Gross Amount: .......................... $3575.00 Federal Tax: ................................ $ 536.25 State Tax: .....................................$ 125.13 Social Security Tax: ................... $ 205.56 Medicare/Medicaid Tax: ......... $ 98.31 Pension Plan: .............................. $ 178.75 Health Insurance: .......................$ 75.00 Net Pay: ....................................... $2356.00 NOTE: The first column is left-justified, and the right column is…arrow_forwardIn C++ Programming, write a program that calculates and prints the monthly paycheck for an employee. The net pay is calculated after taking the following deductions: Federal Income Tax: 15% State Tax: 3.5% Social Security Tax: 5.75% Medicare/Medicaid Tax: 2.75% Pension Plan: 5% Health Insurance: $75.00 Your program should prompt the user to input the gross amount and the employee name. The output will be stored in a file. Format your output to have two decimal places. A sample output follows: Bill Robinson Gross Amount: Federal Tax: State Tax: Pension Plan: . Health Insurance: $3575.00 Social Security Tax: Medicare/Medicaid Tax:.........$ 98.31 Net Pay:...... $ 536.25 $ 125.13 $ 205.56 $ 178.75 $ 75.00 $2356.00arrow_forward
- please use c++ to answer the following questionarrow_forwardWrite a C++ codes based on the image below. Please include these following: - How many products are you going to remove or add? - Select the code of products: - Please select how many pieces (Name of product)arrow_forwardUsing C++ programming Language: Write the code for a game called “ASCII Strength” of a four-letter word selected by Player 1 followed by a four-letter word selected by Player 2. The result would be the sum of the ASCII value of each of the letters of the selected words and whoever has higher sum (called ASCII strength) wins.arrow_forward
- C++ with multiple functions if possible Write a program to simulate an automated teller machine (ATM) at a bank. The program should ask the user for a four-digit personal identification number (PIN) to verify they are supposed to have access to the account. If they enter the PIN incorrectly, they should be denied access to the account, but the program should automatically ask them to enter the PIN again. It is up to you to decide if you want to give a maximum number of tries before exiting. The ATM program should ask the user for a beginning balance, and then provide the user with the opportunity to enter deposits and withdrawals until the user wishes to exit the program. Upon exiting the program, it needs to display the current balance.arrow_forwardC++ Programming It should align exactly like the screenshot, sample output. The local Driver’s License Office has asked you to write a program that grades the written portion of the driver’s license exam. The exam has 20 multiple choice questions. Here are the correct answers: 1. A2. D3. B4. B5. C6. B7. A8. B9. C10.D11. A12. C13. D14. B15. D16. C17. C18. A19. D20. B Your program should store the correct answers shown above in an array. It should ask the user to enter the student’s answers for each of the 20 questions, and the answers should be stored in another array. After the student’s answers have been entered, the program should display a message indicating whether the student passed or failed the exam. (A student must correctly answer 15 of the 20 questions to pass the exam.) It should then display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions.…arrow_forwardThe programming language is C++, write a program base on the given statement. In 2001, Bureau of Internal Revenue proposed an overhaul of theIncome Tax Law. They proposed the ff. schedule: INCOME TAX RATE0 to 5000 0 5001 to 10000 100 + 3% of income over 5000 10001 to 25000 200 + 6% of income over 10000 25001 to 50000 300 + 9% of income over 25000 Over 50000 500 + 15% of income over 50000arrow_forward
- Create a c++ program that asks an employee the following questions: Employee name Employee ID Employee department Number of absences in a month Number of late in a month Let's say that an average employee needs to have 24 days of no late and no absent attendance in a month to earn his/her full salary of 24,000 1 late = 200 pesos deduction 1 absent = 1000 pesos deduction The program would then compute the total salary of the employee based from the information that he/she entered Example output: Please enter your name: Gerard Bautista Please enter your Department: IT Please enter number of lates: 3 Please enter number of absences: 2 Output: Gerard Bautista from IT department has an equivalent of 3 lates and 2 absences. His total earning for the month is 21400.arrow_forwardPlease write a c++ programming code that can work on codechum according to the instructions below. Mario's Pizzaby CodeChum Admin It’s me, Mario! I got a part-time job as a pizza chef because plumbing isn’t enough to pay the bills anymore. Pizza making is great and all but a lot of customers come in and try to negotiate the price with me. I don’t wanna take away options from them so I decided to make a pizza size for every amount as long as they pay greater than or equal to 1 peso and the amount they paid is an odd (not even) amount. Unfortunately, I wasn’t able to get programming education because I spent my youth collecting mushrooms! Oh, Coding Hero, please help your favorite Italian plumber/pizza chef by creating an algorithm that decides pizza size depending on the amount they paid! Input 1. Amount of pesos paid Constraints The amount is >= 1 and is odd. Output The first line will contain a message prompt to input the amount of pesos paid.The succeeding lines will contain the…arrow_forwardHere kutout so called :Quiz score: 80 Mid-term score: 68 Final score: 90.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Control Structure in Data Structure - Data Structures - Computer Science Class 12; Author: Ekeeda;https://www.youtube.com/watch?v=9FTw2pXLhv4;License: Standard YouTube License, CC-BY