Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

write a program that simulates the printing of a paycheck. ask the program user for the name ... Your question has been answered Let us

write a program that simulates the printing of a paycheck. ask the program user for the name ... Your question has been answered Let us know if you got a helpful answer. Rate this answer Question: Write a program that simulates the printing of a paycheck. Ask the program user for the name of t... Write a program that simulates the printing of a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceed 40, the employee is paid time and a half, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwise refinement and break your solution should have several functions. Use the given intName.py file to print the dollar amount of the check. A sample run is shown below. Name your file as check.py Enter the name of the employee: Yogi Bear Enter the hourly pay rate: 50.77 Enter the hours worked: 60 ABC Solutions, 888 First Street, Kamloops. BC, Canada, V2C1K1 Pay Amount is: $3,553.90 Three thousand Five hundred Fifty Three and 90/100 To the order of: Yogi Bear

this is intName file given

## Turns a number into its English name.

# @param number a poistive integer < 1,000,000,000

# @return the name of the number (e.g. "two hundred seventy four")

#

def intName(number) :

name = ""

part = number if part >= 1000000 :

name = name + intName1000(part // 1000000) + " million "

part = part % 1000000 if part >= 1000 :

name = name + intName1000(part // 1000) + " thousand "

part = part % 1000 if part >= 1 :

name = name + intName1000(part)

part = part

return name

## Turns a number into its English name.

# @param number a poistive integer < 1,000

# @return the name of the number (e.g. "two hundred seventy four")

# d

ef intName1000(number)

part = number # The part that still needs to be converted.

name = "" # The name of the number.

if part >= 100 :

name = digitName(part // 100) + " hundred"

part = part % 100

if part >= 20 :

name = name + " " + tensName(part)

part = part % 10

elif part >= 10 :

name = name + " " + teenName(part)

part = 0

if part > 0 :

name = name + " " + digitName(part)

return name

## Turns a digit into its English name.

# @param digit an integer between 1 and 9

# @return the name of digit ("one" ... "nine")

#

def digitName(digit) :

if digit == 1: return "One"

if digit == 2: return "Two"

if digit == 3: return "Three"

if digit == 4: return "Four"

if digit == 5: return "Five"

if digit == 6: return "Six"

if digit == 7: return "Seven"

if digit == 8: return "Eight"

if digit == 9: return "Nine"

return ""

## Turns a number between 10 and 19 into its English name.

# @param number an integer between 10 and 19

# @return the name of the given number ("ten" ... "nineteen")

#

def teenName(number) :

if number == 10 : return "Ten"

if number == 11 : return "Eleven"

if number == 12 : return "Twelve"

if number == 13 : return "Thirteen"

if number == 14 : return "Fourteen"

if number == 15 : return "Fifteen"

if number == 16 : return "Sixteen"

if number == 17 : return "Seventeen"

if number == 18 : return "Eighteen"

if number == 19 : return "Nineteen"

return ""

## Gives the name of the tens part of a number between 20 and 99.

# @param number an integer between 20 and 99

# @return the name of the tens part of the number ("twenty" ... "ninety")

#

def tensName(number) :

if number >= 90 : return "Ninety"

if number >= 80 : return "Eighty"

if number >= 70 : return "Seventy"

if number >= 60 : return "Sixty"

if number >= 50 : return "Fifty"

if number >= 40 : return "Forty"

if number >= 30 : return "Thirty"

if number >= 20 : return "Twenty"

return ""

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions