Implement your algorithm in python

Assignment Help Python Programming
Reference no: EM13729042

W Mart, a new retail chain, has announced a discount on the total sale amount, in a single transaction, using the following scheme.

Table 1: Discount on Sale Amount

Total Sale Amount

Discount on this sale amount

Less than $100

0%

From $100 up to less than $500

10% for each dollar over $100

From $500 up to less than $1,000

$40 PLUS 20% of the total sale amount over $500

From $1,000 up to less than $2,000

$140 PLUS 30% of the total sale amount over $1,000

$2,000 and above

$440 PLUS 40% of the total sale amount over $2,000

That is, if the total sale amount is $100 then the discount will be $0. However, if the total sale amount is $101 then the discount will be $0.10. If the total sale amount is $500 then the discount will be $40, but if the total sale amount is $501 then the discount will be $40.20.

W Mart keeps track of a customer through a unique customer ID. W Mart gives one reward point for every $100 spent irrespective of the number of transactions. The points accumulate over the time for a customer for his/her purchases. Finally, for each 100 reward points it gives an additional discount of $10 on a purchase over $10 in a transaction.

Write a Python program that, for every transaction, takes input on the customer ID and the total sale amount in the transaction. It then reads a text file called discount.txt that stores information on the discount on sales amount as shown in Table 1 above. The text file stores the information in a plain text format as follows.


Less than $100 --> 0%
From $100 up to less than $500 --> 10%
From $500 up to less than $1,000 --> $40 PLUS 20%
From $1,000 up to less than $2,000 --> $140 PLUS 30%
$2,000 and above --> $440 PLUS 40%

At the end of each transaction the following information is written (appended) out in a file called sales.txt. The same information is also displayed on screen.

Customer ID: 1
Total sale amount: 110
Discount amount: 1
Discounted sale amount: 109

Reward point: 1
Additional discount: 0
Additional discounted sale amount: 109
Cumulative sale amount for the next reward point: 10

Final sale amount: 109 

Use appropriate data structure in writing your code.

All exceptions need to be handled. Invalid inputs need to be handled and asked for a valid input again. 

Use functions to make your program well designed, instead of just using a single main function. For example, you could use a function to take inputs from a user, a function to compute the discount, a function to compute the reward points, a function to display the output on the screen and so on. We expect you to use at least four (4) functions other than the main function.

In order to compute the reward points of a customer your program will need to read the sales.txt file. A customer is identified by her/his unique Customer ID, and may appear multiple times in the sales.txt file.

Write an algorithm in structured English (pseudocode) that describes the steps required to perform the task specified. Some examples of pseudocode can be found

Implement your algorithm in Python.

Reference no: EM13729042

Questions Cloud

Create a form that includes areas the supervisors : To correct this situation, you will begin by creating a performance grading form that will be used to assess the front-line supervisor's performance. Create a form that includes areas the supervisors should be graded on and the relative weight or ..
Determine and explain what type of leader steve jobs was : Apple Computer Leadership Report: Determine and explain what type of leader Steve Jobs was
How did president hoover react to the crash on wall street : How did President Hoover react to the crash on Wall Street and the Depression? How did the people react to his policies? How did this effect the presidential election of 1932?
Create risk responses for each of the 15 risks : Create risk responses (reduce probability, reduce impact, and respond) for each of the 15 risks you identified and assessed in the prior unit.
Implement your algorithm in python : Write a Python program that, for every transaction, takes input on the customer ID and the total sale amount in the transaction.
Prepare a presentation on profit and international marketing : Prepare a presentation on profit and international marketing
Explain concepts of patient safety and standard precautions : Use initials only, with no other identifiers. Include the sections below. Remember to include all concepts of patient safety, standard precautions, and professional standards.
Discuss the features of the clinton health care reform plan : Discuss the features of the Clinton health care reform plan and provide reasons why it failed and describe the influence of the various interest groups and governmental entities during this process. Make sure to discuss both the policy process and..
What separates the peak performing brands : In recent years, social media has been a rapidly growing marketing communications vehicle. What separates the peak performing brands from the "also-rans" in this medium

Reviews

Write a Review

Python Programming Questions & Answers

  Same directory as your program

In the same directory as your program, create a file FF1, and write into it Hello (with a space at teh end). Similarly, create a file FF2, and write into it world! (with a new line, i.e., an ENTER at the end). And create a file DD and write into i..

  When we sort a list of items, we need a basis

When we sort a list of items, we need a basis on which to compare the items to see whether one is bigger than another. If it's a list of numbers, Python just compares the numeric values; if it's a list of strings, Python compares the strings alpha..

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  What prompted the authors to try and address

What is the question that this study is trying to answer and what prompted the authors to try and address this question?

  What are the issues assciated with top-down analysis

what are the issues assciated with top-down analysis please explain?

  Explain a python program storing and processing simple bank

A Python program storing and processing simple bank records is in the early stages of development. The records are stored in a text file (bank.txt) that contains, for each bank customer, their given name, account number and balance.

  Improve the structural design - haunted house game

List the things you changed and the purpose of changing it. Good reasons include making code easier to read and easier to navigate when modifying it.

  The program should allow the student

The program should allow the student to enter the answer. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed.

  Programmer does not have to use the def statement

Unlike Z+-, the programmer does not have to use the DEF statement to create a variable. Instead, the programmer can simply use the variable. The first use of the variable creates it and initializes it to 0.

  Arithmetic progression is a sequence of numbers

An arithmetic progression is a sequence of numbers in which the distance (or difference) between any two successive numbers if the same.

  Assignment brief you are tasked with improving the code for

assignment brief you are tasked with improving the code for the haunted house game. please read the associated hand-out

  Student record due smartsite thursday 1211 1155 pm file

due smartsite thursday 1211 1155 p.m. file names grading.py ltbrgtall prompts for input and all output must match my

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd