Question

Program using  Python Q#1 Cost of Bagels: A bagel shop charges 8C cents per bagel for orders...

Program using  Python

Q#1 Cost of Bagels: A bagel shop charges 8C cents per bagel for orders of less than a half-dozen bagels and 60 cents per bagel for orders of a half-dozen or more. Write a program that requests the number of bagels ordered and displays the total cost. How many bagels are ordered: 12 The cost of 12 bagels is $7.20.

Q#2 Overtime Pay. Federal law requires that hourly employees be paid "time-and-a-half" for work in excess of 40 hours a week. For example, if a person's hourly wage is $15 and he or she works 60 hours in a week, the person's grow pay should be (40 * 15) 1.5 * 15 * (60 — 40)) = $1050 Enter the hourly wage: 12.50 Enter the number of hours worked: 47 The gross pay for the week is $631.25

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Q#1

x = int(input("Number of Bagels ordered : ")) #input number of bagels
dol = 0 #initialising dol as 0
cents = 0 #initialising cents as 0
if x<6 : #condition to check if number of bagels are less than 6
cents=80*x #assuming cost as 80 cents and calculating the cost
else: #condition to check if number of bagels are more than or equal to 6
cents=60*x #calculating cost
#converting it to dollars and cents
if cents >=100:
dol=cents/100
cents=cents%100
#printing the output
print("The cost of " + str(x) + " Bagels is $" + str(int(dol)) + "." + str(int(cents)))

Q#2

h_w = float(input("Enter the hourly wage in $ : ")) #input for hourly wages
hrs = float(input("Enter the number of hours worked : ")) #input for number of hours worked
cost = 0 #initialising cost as 0
if hrs <= 40: #condition to check if number of hours are less than or equal to 40
cost = h_w*hrs #calculating cost
else: #condition to check if number of hours are more than 40
cost = (h_w*40)+(h_w*1.5*(hrs-40)) #calculating cost
print("The gross pay for the week is $" + str(cost)) #printing the output

Add a comment
Know the answer?
Add Answer to:
Program using  Python Q#1 Cost of Bagels: A bagel shop charges 8C cents per bagel for orders...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Problem : Overtime Pay: Federal law requires that hourly employees be paid “time-and-a-half” for work in...

    Problem : Overtime Pay: Federal law requires that hourly employees be paid “time-and-a-half” for work in excess of 40 hours a week. For example, if a person’s hourly wage is $15 and he or she works 60 hours in a week, the person’s grow pay should be (40 * 15) + 1.5 * 15 * (60 – 40)) = $1050 Enter the hourly wage: 12.50 Enter the number of hours worked: 47 The gross pay for the week is $631.25

  • Python)) A copy center charges 5 cents per copy for the first 100 copies and 3...

    Python)) A copy center charges 5 cents per copy for the first 100 copies and 3 cents per copy for each additional copy. Write a program that requests the number of copies as input and display the total cost. Federal law requires that hourly employees be paid “Time and a half” for work in excess of 40 hours in a week. For example, if a person’s hourly wage is $ 12 and he/ she works 60 hours in a week,...

  • Create a dual-alternative selection structure using Python: A company ABC asked you to design a simple...

    Create a dual-alternative selection structure using Python: A company ABC asked you to design a simple payroll program that calculates and employee's weekly gross pay, including any overtime wages. If employees work over 40 hours in a week, they will get 1.5 times of their regular hourly rate for all hours over 40. Your program asks the user to input hours worked for a week, regular hourly rate, and then display the weekly gross pay Output sample Enter weekly hours...

  • Python)) Data types of Python. Write the python script to show the different examples. Write the...

    Python)) Data types of Python. Write the python script to show the different examples. Write the Python script to present ALL the mathematical arithmetic operations. Write the Python script to display your - first name, last name, ID, college name and the program of study. Write the Python script to receive the number of seconds as input and display the hours, minutes and seconds as output. Assume the variable x to be with the string of "Day by day, dear...

  • Python 3 Question Please keep the code introductory friendly and include comments. Many thanks. Prompt: The...

    Python 3 Question Please keep the code introductory friendly and include comments. Many thanks. Prompt: The owners of the Annan Supermarket would like to have a program that computes the weekly gross pay of their employees. The user will enter an employee’s first name, last name, the hourly rate of pay, and the number of hours worked for the week. In addition, Annan Supermarkets would like the program to compute the employee’s net pay and overtime pay. Overtime hours, any...

  • (JAVA Please) Program 1: FICA!? What’s FICA? If you’re taking this course, chances are that you’re...

    (JAVA Please) Program 1: FICA!? What’s FICA? If you’re taking this course, chances are that you’re going to make a pretty good salary – especially 3 to 5 years after you graduate. When you look at your paycheck, one of the taxes you pay is called FICA – or Federal Insurance Contributions Act. In simplest terms, it’s what funds our Social Security and Medicare systems (and the more that you work, the more you get). Interestingly, your employer will pay...

  • Let's update our program, SalaryCalcLoop.java, from last week, to now take input about each employee from...

    Let's update our program, SalaryCalcLoop.java, from last week, to now take input about each employee from a file and write their information and salary/pay information to a file. Rashid night 60 20 Chin day 30 15 Tran day 45 10 Deeshan night 55 11.5 Serena day 24 10 Deepak day 66 12 Tyrone night 11 18 Andre night 80 15 import java.util.Scanner; import java.io.*; import java.io.FileWriter; import java.util.NoSuchElementException; public class SalaryCalcLoop{ double pay=0, OTpay=0; void gpay(double hours, double wage){ if...

  • Program 1: Social Security Payout. If you’re taking this course, chances are that you’re going to...

    Program 1: Social Security Payout. If you’re taking this course, chances are that you’re going to make a pretty good salary – especially 3 to 5 years after you graduate. When you look at your paycheck, one of the taxes you pay is called Social Security. In simplest terms, it’s a way to pay into a system and receive money back when you retire (and the longer you work and the higher your salary, the higher your monthly benefit). Interestingly,...

  • C++ Programming Assignment Objectives: The objectives of Week 1 assignment is: Implement multiple selection using the...

    C++ Programming Assignment Objectives: The objectives of Week 1 assignment is: Implement multiple selection using the control statements ( i. e switch selection statement) Work with functions in C++ and to use the logical operators Assignment Purpose: To write a program that demonstrates the concepts of the control statements that we learned this week. Assignment Description: Problem Description: A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for...

  • Exercise 1 A program was created that outputs the following unto the console: Hello! What is...

    Exercise 1 A program was created that outputs the following unto the console: Hello! What is your name: Hello, Jane Doe! Using this program, we can help you determine you pay for the week! Please enter the hours you worked this week: 20 Next, please enter your rate of pay: 10 Calculating… you will make $ 200 by the end of the week! Here is the code for that program (you should have written a close variant of this last...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT