Question

In: Computer Science

Assignment Description This assignment focuses on programming basics; expressions, variables, constants, methods, selection and loops. Danny...

Assignment Description

This assignment focuses on programming basics; expressions, variables, constants, methods, selection and loops.

Danny runs an ice cream shop in the inner suburbs of Melbourne. Due to the growing number of customers, Danny has decided to take on extra casual employees. In order to manage payroll for his employees, Danny has decided to develop an employee payroll management system. Details of each employee to be maintained in the system will include; employee id, name, gender (M or F), phone number, hours worked, pay per hour, gross pay, net pay, and income tax payable.

The gross pay is calculated as the number of hours worked multiplied by pay per hour, while the net pay is calculated as the difference between gross pay and income tax payable of which income tax payable is calculated by multiplying gross pay by an income tax rate of 30%. Any hours over forty (40) is paid as an overtime hour at the rate of (2.5) times the base hourly rate.

For example, an employee who has worked a total of 45 hours with an hourly rate of $20 will have;

Regular pay=40*$20=$800

Overtime pay=5 * $20 * 2.5 = $250

Gross pay=$800 + $250 = $1,050

Income tax payable=$1050 * 30%=$315

Net pay=$1050-$315=$735

Task Requirements

Imagine you have been hired to develop this system. Familiarise yourself with the problem description and write a python program named payroll.py with the following functions:

  1. Create a main () as a driver function in your payroll progam. Within the main (), you will declare all the required variables, and invoke the other methods described in the next step as required for calculations and displaying the program output.

  1. Create additional functions in your payroll program for calculations as follows:
    1. Function to calculate the overtime hours
    2. Function to calculate the gross pay
    3. Function to calculate the income tax payable and
    4. Function to calculate the net pay

These functions needs to be invoked in correct order within your driver function main (), so that when your program executes, it should be able to produce an output as an employee’s pay slip like the example below.

Submission requirements:

  1. Your assignment should include the following in the .ZIP archive:
  • A Word report with sections containing:
    1. An overview of the problem description of the assignment
    2. Pseudocode as an algorithm for the program
    3. Screen shot/capture of the program output
    4. Statement of completion
    5. Acknowledgment of any help taken for assignment completion    
  • Python file (payroll.py) that can be executed by your tutor

  1. Instructions for archiving and submitting your files:
  • Create a folder and name it with your student ID (MITnnnnnn, where nnnnnn are digits of your student number)
    • Copy your Word document and the python (payroll.py) files into that folder.
    • Zip the folder.
      1. Right-click on the folder
      2. In the pop-up menu select Send-to, Compressed (zipped)Folder
  • Then submit this zipped folder in Moodle submission link

Marking criteria:

Program Demonstration: Students must demonstrate their program in week8 (lab time) to the tutor, and are expected to explain their implementation. Marks will be deducted (50% -maximum) for failing to do demonstration or poor explanation.

Description of criteria

Marks

Assignment report

Overview

0.5

Pseudocode

1

Statement of completion and acknowledgement

1

Python implementation

Comments describing the program, methods, author and date

1.5

Design of main function is correctly implemented

4

Design of overtime function is correctly implemented

2

Design gross pay function is correctly implemented

2

Design of income tax payable function is correctly implemented

2

Design of net pay function is correctly implemented

2

Program runs and prints the correct output

4

Total

20

Solutions

Expert Solution

Thanks for the question.

Here is the completed code for this problem. Comments are included so that you understand whats going on. Let me know if you have any doubts or if you need anything to change.

Thank You !!

=============================================================================================

#Function to calculate the overtime hours
def calculate_overtime(hrs):
    if hrs <=40:
        return 0
    else:
        return hrs-40

#Function to calculate the gross pay
def calculate_grosspay(hrs,rate):
    overtime=calculate_overtime(hrs)
    return (hrs-overtime)*rate + overtime*rate*2.5

#Function to calculate the income tax payable
def calculate_incometax(grosspay):
    return grosspay*0.30


#Function to calculate the net pay
def calculate_netpay(hrs,rate):
    gross_pay=calculate_grosspay(hrs,rate)
    i_tax=calculate_incometax(gross_pay)
    return gross_pay-i_tax

# get employee details
def input_employee():
    name= input('Enter employee name: ')
    employee_id=input('Enter employee id: ')
    gender =input('Enter gender (M or F): ')
    phone_number=input('Enter phone number: ')
    hours_worked = int(input('Enter hours worked: '))
    pay_per_hour=float(input('Enter pay per hour: $'))
    return name,employee_id,gender,phone_number,hours_worked,pay_per_hour

# print details of employee
def display(record):
    print('Employee Name : {}'.format(record[0]))
    print('Employee ID   : {}'.format(record[1]))
    print('Gender        : {}'.format(record[2]))
    print('Phone Number  : {}'.format(record[3]))
    print('Hours Worked  : {}'.format(record[4]))
    print('Pay Per Hour  : {}'.format(record[5]))
    print('Gross Pay     : ${0:.2f}'.format(record[6]))
    print('Income Tax    : ${0:.2f}'.format(record[8]))
    print('Net Pay       : ${0:.2f}'.format(record[7]))

# main()
def main():
    print('Dannys Payroll Management System')
    records=[]
    while True:
        name, id, gender, ph_num, hrs, rate=input_employee()
        gross_pay=calculate_grosspay(hrs,rate)
        net_pay=calculate_netpay(hrs,rate)
        income_tax= calculate_incometax(gross_pay)
        record=[name, id, gender, ph_num, hrs, rate,gross_pay,net_pay,income_tax]
        records.append(record)
        display(record)
        print('Record saved successfully')
        add_another=input('Do you want to add another (Y or N): ')
        if add_another=='n' or add_another=='N':
            break
    print('Thanks for using the Payroll Management System. Bye.')

main()
=================================================================================================


Related Solutions

JAVA programming- answer prompts as apart of one java assignment Static static variables static methods constants...
JAVA programming- answer prompts as apart of one java assignment Static static variables static methods constants Create a class Die representing a die to roll randomly. ☑ Give Die a public final static int FACES, representing how many faces all dice will have for this run of the program. ☑ In a static block, choose a value for FACES that is a randomly chosen from the options 4, 6, 8, 10, 12, and 20. ☑ Give Die an instance variable...
This assignment will acquaint you with the use of while loops and boolean expressions. You will...
This assignment will acquaint you with the use of while loops and boolean expressions. You will create a program that acts as a score keeper of a racquet ball game between two players. The program will continually ask the user who the winner of every point is as the game is played. It will maintain the scores and declare the match is over, using these rules: (1) A game is over when a. one of the players wins 7 points...
This assignment focuses on demand, supply, and equilibrium. Let’s start with the basics. Begin your essay...
This assignment focuses on demand, supply, and equilibrium. Let’s start with the basics. Begin your essay by providing the following information. Explain the difference between a movement along demand and supply curves and a shift of demand and supply curves. What can cause the above situations? Provide an example for each. Describe how equilibrium is found. Describe how a shift of the demand or supply curve can affect equilibrium. Now, select an industry with which you are familiar or one...
Assignment 8: Recruitment (Selection) need a different answers For the same job description from Assignment 7,...
Assignment 8: Recruitment (Selection) need a different answers For the same job description from Assignment 7, please create interview questions. Interview questions should target key attributes that are important to the role. There should be questions for the following aspects: Cultural fitTechnical expertiseBehavioural attributes While you may google to get ideas of interview questions, do not directly copy and paste interview questions from the internet, please use the web as resources to supplement your learning in the course and tailor...
Array Selector Problem Overview This assignment focuses on implementing the methods of a class much like...
Array Selector Problem Overview This assignment focuses on implementing the methods of a class much like java.util.Arrays. The Selector.java file defines a class with static methods designed to provide useful functionality on arrays, with the common theme of selecting values in an array with particular properties. Each method of Selector is clearly specified, is independent of the other methods in the class, and is designed to provide relatively simple functionality. So, this is a great context in which to practice...
Description: In this assignment, you will implement a deterministic finite automata (DFA) using C++ programming language...
Description: In this assignment, you will implement a deterministic finite automata (DFA) using C++ programming language to extract all matching patterns (substrings) from a given input DNA sequence string. The alphabet for generating DNA sequences is {A, T, G, C}. Write a regular expression that represents all DNA strings that begin with ‘A’ and end with ‘T’. Note: assume empty string is not a valid string. Design a deterministic finite automaton to recognize the regular expression. Write a program which...
Description CSCI 1151, Fall 2019 Programming Assignment 5 – Structure Construct an array of a structure...
Description CSCI 1151, Fall 2019 Programming Assignment 5 – Structure Construct an array of a structure to store the information of vehicles. This structure should consist of: an integer for the vehicle identification number (ID); an integer for the mile driven; an integer for the number of gallons used by the vehicle; and a string for the vehicle’s manufacture. Write a C program that get (input) the information of the vehicles from a file, cardb.txt, one structure per vehicle. Your...
Optional Assignment 1: Method Man Assignment Description Write some methods and call them from the main....
Optional Assignment 1: Method Man Assignment Description Write some methods and call them from the main. Tasks Write a method called nickelbackMeme with a void return type, a string parameter, and an int parameter The method outputs the text “LOOK AT THIS…” plus the string parameter at the end. The method will do this as many times as the int parameter. If 0 or a negative number is entered for the int parameter, output “WHAT THE HELL IS ON JOEY’S...
Description: For this assignment, you are required to write 3 recursive methods described below. Create a...
Description: For this assignment, you are required to write 3 recursive methods described below. Create a class named HW06 and implement the following 3 methods . The implementation MUST use recursive calls. - static int multiplyPositiveIntegers(int a, int b) //multiplies two positive integers using recursion (no use of * allowed). Returns the result of multiplication. (30 points) - static void recursiveBubbleSort(int[] arr) //Sorts an array using bubble sort in a recursive manner. Hint: do one pass(which puts the biggest element...
Java Programming II Homework 2-1 In this assignment you are being asked to write some methods...
Java Programming II Homework 2-1 In this assignment you are being asked to write some methods that operate on an array of int values. You will code all the methods and use your main method to test your methods. Your class should be named Array Your class will have the following methods (click on the method signatures for the Javadoc description of the methods): [ https://bit.ly/2GZXGWK ] public static int sum(int[] arr) public static int sum(int[] arr, int firstIndex, int...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT