Question

Problem Statement (Python) You have been asked to write a program for a retail store that...

Problem Statement (Python)

You have been asked to 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 number of years worked as well as if the employee is a manager or hourly employee. They are also allowed no discount once they have received $200 in discounts for the year.

Note:   Once you complete the discount for the employee, a question should be asked as to if there is another employee. If there is, collect the input and process the data for the next employee as such. Do this until the user answers “NO” for “Another Employee”. Once all employees have been processed, display the All Employee Summary and end the program.

INPUT

The application must be able to collect the following “required” information for each employee:

  1. Number of years employed (required, numeric, >0)
  2. Total amount of previous purchases before discount (required, numeric, >=0)
  3. Employee status (employee or manager)
  4. Total of today’s purchase (required, numeric, >=0)

OUTPUT

            There are two distinct areas required for output:

  1. For each employee display the following:
    1. Employee discount percentage
    2. YTD Amount of discount in dollars
    3. Total purchase today before discount
    4. Employee discount this purchase
    5. Total with discount
  2. (All Employee Summary) Calculate the total for all employees for today’s date:
    1. Total before discount for the day   
    2. Total after discounts applied

PROCESS

Employee discount standard

Years of Employment

Management

Hourly

1-3 Years

20%

10%

4-6 Years

24%

14%

7-10 Years

30%

20%

11-15 Years

35%

25%

More than 15 Years

40%

30%

           

YTD discount in dollars = total purchase before today * discount

Employee discount this purchase:

The discount for the purchased is based on the YTD discounts already realized. Meaning, an employee or manager only receives $200 in discount for the year.

Therefore:

  • If an employee has already accumulated $200 in discounts prior to the current purchase…then no discount for this purchase.
  • If the (Total of the YTD Discount + Current Discount) < 200…..then the current purchase receives the whole discount.
  • If the (Total of the YTD Discount + Current Discount) > 200…..then the current purchase receives the only a partial discount up to the 200 dollar YTD max.

Total with discount: Total * discount allowed

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


Program Screen Shot:

Sample Output:

Program Code to Copy:


# for all employee summary
total_all_before_discount = 0
total_all_after_discount = 0

# discount options
management_discount = [0.20,0.24,0.30,0.35,0.40]
employee_discount = [0.10,0.14,0.20,0.25,0.30]

another_employee = True
while another_employee:
  
# initialize the looping variables to invalid values
years = -1
previous_amount = -1
today_amount = -1
status = 'unknown'
  
# get inputs and validate until valid inputs are given
while years<=0:
years = int(input('Enter number of years employed: '))
while previous_amount<0:
previous_amount = float(input('Enter total amount of previous purchases before discount($): '))
while not (status == 'manager' or status == 'employee'):  
status = input('Enter status (employee/manager) ?: ').lower()
while today_amount<0:
today_amount = float(input('Enter total of today’s purchase($): '))
  
# get index to reference the discount options/table
if years>=1 and years<=3:
index = 0
elif years>=4 and years<=6:
index = 1
elif years>=7 and years<=10:
index = 2
elif years>=11 and years<=15:
index = 3
elif years>15:
index = 4
  
# reference the discount options using index and status
if status == 'manager':
discount_percentage = management_discount[index]
elif status == 'employee':
discount_percentage = employee_discount[index]
print('\nDiscount percentage is ',discount_percentage)

# YTD
ytd_amount_discount = previous_amount * discount_percentage
print('YTD Amount of discount in dollars is $',ytd_amount_discount)
# total today
print('Total purchase today before discount is $',today_amount)
  
# compute discount amount
current_discount = today_amount * discount_percentage
discount_this_purchase = 0
if ytd_amount_discount>=200:
discount_this_purchase = 0
elif (current_discount + ytd_amount_discount) < 200:
discount_this_purchase = current_discount
elif (current_discount + ytd_amount_discount) >= 200:
discount_this_purchase = 200 - ytd_amount_discount
print('Discount this purchase is $',discount_this_purchase)

total_with_discount = today_amount * discount_this_purchase
print('Total with discount is $',total_with_discount)
  
# uodate the totals for all employees
total_all_before_discount = total_all_before_discount + today_amount
total_all_after_discount = total_all_after_discount + total_with_discount
  
# continuity
another_employee = input('\nAnother employee? (YES/NO): ').upper() == 'YES'
print('-------------------------------------------------------------------')

# display all employees summary
print('\n****All Employee Summary****')
print('Total before discount for the day is $',total_all_before_discount)
print('Total after discounts applied is $',total_all_after_discount)

------------------------------------------------------------------------------
COMMENT DOWN FOR ANY QUERY RELATED TO THIS ANSWER,

IF YOU'RE SATISFIED, GIVE A THUMBS UP
~yc~

Add a comment
Know the answer?
Add Answer to:
Problem Statement (Python) You have been asked to write a program for a retail store that...
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
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