Wednesday, August 5, 2020

Assessment item 1 - Membership Fee Calculator




Value: 10%




Due Date: 16-Aug-2020
Return Date: 04-Sep-2020
Submission method options: Alternative submission method



A local sports club needs a membership fee calculator program to help their staff calculating the fees for their customers. The base annual fee may vary each year, so the exact discount amount can be different. Also, the club has a discount program that rewards group and loyalty memberships. The discount is calculated according to the following table:
Years
Group count
12-45 and above
00%10%20%
1-310%20%30%
4 and above20%30%40%
You are required to design and write an interactive program that prompts the user for base membership fee, the number of years and the number of group members, and displays the total membership fee before and after the discount. The program should allow the user to calculate the fees again and should continue until the user decides to quit.
Review the sample run below to clearly understand all requirements.
Enter the base membership fee, or zero to quit: 500
Enter the group count: 1
Enter the number of membership years: 2

Total fees before discount: 500
Discount: 50
Total fees after discount: $450

Enter the base membership fee, or zero to quit: 600
Enter the group count: 5
Enter the number of membership years: 2

Total fees before discount: $3000
Discount: $1000
Total fees after discount: $2000

Enter the base membership fee, or zero to quit: 0

Have a nice day!
Your submission must consist of following tasks:
Task 1
Draw a flowchart that presents the steps of the algorithm required to perform the task specified. You can draw the flowcharts with a pen/pencil on a piece of paper and scan it for submission, as long as the handwriting is clear and legible. However, it is strongly recommended to draw flowcharts using a drawing software. Here are links to some free drawing tools

Task 2
Implement your algorithm in Python. Comment on your code as necessary to explain it clearly.
Your submission will consist of:
  1. Your algorithm through flowchart/s
  2. Source code for your Python implementation



Rationale
This assessment task will work towards assessing the following learning outcome/s:
  • be able to analyse the steps involved in a disciplined approach to problem-solving, algorithm development and coding.
  • be able to demonstrate and explain elements of good programming style.
  • be able to identify, isolate and correct errors; and evaluate the corrections in all phases of the programming process.
  • be able to interpret and implement algorithms and program code.
  • be able to apply sound program analysis, design, coding, debugging, testing and documentation techniques to simple programming problems.
  • be able to write code in an appropriate coding language.


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

#https://www.omnicalculator.com/finance/discount#discount-formula
#three inputs asking for the membershipfee, groups and years

while True:
    m = int(input("Enter the base membership fee, or zero to quit: "))
    if m == 0:
        break

    g = int(input("Enter the group count: "))
    years = int(input("Enter the number of membership years: "))


#calculation to work out the fee
    fee = m * g
    discount = 0
#checks to see if the number of group is more than 5 so that the additional % fee can be added
    if g==1:
#calculates the extra cost if the condition is true
        if years == 0:
            discount = fee * 0/100
        elif  years >= 1 and years <= 3:
            discount = fee * 10/100
        elif years >= 4:
            discount = fee * 20/100
        else :
            print("Have a Nice day!")

    elif g>=2 and g<=4:
#calculates the extra cost if the condition is true
        if years == 0:
            discount = fee * 10/100
        elif  years >= 1 and years <= 3:
            discount = fee * 20/100
        elif years >= 4:
            discount = fee * 30/100
        else :
            print("Have a Nice day!")
   
    elif g>=5:
#calculates the extra cost if the condition is true
        if years == 0:
            discount = fee * 20/100
        elif  years >= 1 and years <= 3:
        discount = (fee * 30/100)
        elif years >= 4:
            discount = fee * 40/100
        else :
            print("Have a Nice day!")
   
    else :
            print("Have a Nice day!")

 #discounted_price = original_price - (original_price * discount / 100)
    total = fee - discount
 
#displays the total fee after discount
    print("Total fee before discount is ${:.2f}".format(fee))
#displays the Discount
    print("Discount is ${:.2f}".format(discount))

#displays the total fee after discount
    print("Total fee after Discount is ${:.2f}".format(total))

print("Have a Nice day!")


No comments:

Post a Comment

Python Files and Exceptions: Unit 9

  Table of contents Reading from a File Reading an Entire File File Paths Reading Line by Line Making a List of Lines from a File Working wi...