Change Contents of the Bubble
Welcome to CS1315. Click on the python to add comments.

This page removed for FERPA compliance
View this PageEdit this Page (locked)Uploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Midterm Exam 1 Review Fall 2004: Compute the pay rate

Post your answers, questions, comments, comments on answers, suggestions, suggestions on questions, etc.

Back to Fall2004 Midterm 1 Review


def pay(hours,rate):
  pay = hours*rate
  if pay < 100:
    tax = pay*.25
  if pay >= 200 and pay <300:
    tax = pay*.35
  if pay >= 300 and pay <400:
    tax = pay*.45
  if pay >= 400:
    tax = pay*.50
  print pay
  print pay-tax


are the intervals intentional? There is no range for a gross pay of 100-199.
Whether intentional or not, it seems people earning in that tax bracket get a break. But anyways, jREMOVEDt work according to what it says. Your function would then return gross pay and net pay being equal for amounts in the 100-199 range. Student1594

def pay(hours,hourlyrate):
grosspay=hours*hourly rate
if grosspay <100:
netpay=grosspay *.25
if grosspay>=200 and <300:
netpay=grosspay*.45
if grosspay>+300 and <400:
netpay=grosspay*.45:
if grosspay>=400:
netpay=grosspay*.5
print "gross pay is" + grosspay
print "net pay is" + netpay

If the netpay is the grosspay-taxed amount, wouldn't the netpay be the grosspay multiplied by the amount of grosspay that is left after taxes?? so instead of netpay=grosspay*taxrate, wouldn't it be netpay=grosspay*(1-taxrate) ?

Right, so REMOVEDually you compute
taxable=grosspay*taxrate
and then
netpay = grosspay - taxable
Mark Guzdial


def pay(hours, rate):
grossPay = hoursrate
print grossPay
if grossPay 100:
netPay = (grossPay-(grossPay0.25))
if grossPay in range(200,300):
netPay = (grossPay-(grossPay0.35))
if grossPay in range(300, 400):
netPay = (grossPay-(grossPay0.45))
if grossPay >= 400:
netPay = (grossPay-(grossPay0.50))
print netPay


SC

def pay(h,r):
grosspay=hr
if grosspay 100:
netpay=grosspay-(grosspay.25)
if grosspay >=200 and grosspay 300:
netpay=grosspay-(grosspay.35)
if grosspay >=300 and grosspay 400:
netpay=grosspay-(grosspay.45)
if grosspay >=400:
netpay=grosspay-(grosspay.50)
print grosspay
print netpay



Link to this Page