Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Python Expert

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.

Python, Programming

  • Category:- Python
  • Reference No.:- M91268416
  • Price:- $75

Priced at Now at $75, Verified Solution

Have any Question?


Related Questions in Python

A software company sells a package that retails for 99

A software company sells a package that retails for $99. Quantity discounts are given according to the following table: Quantity Discount 10 - 19 20% 20 - 49 30% 50 - 99 40% 100 or more 50% Write a program using python t ...

Question research pythons dictionary data type dictdiscuss

Question : Research Python's dictionary data type (dict). Discuss its interface and usage. Include examples. Discuss practical applications of dictionaries.

Part i the assignment filesone of the most important

Part I: The Assignment Files One of the most important outcomes of this assignment is that you understand the importance of testing. This assignment will follow an iterative development cycle. That means you will write a ...

Architecture and system integrationcase study queensland

Architecture and System Integration Case Study: Queensland Health - eHealth Investment Strategy After evaluating various platforms, Queensland Health finally decided to adopt a Service Oriented Architecture (SOA) for its ...

In this programming assignment you will write a client

In this programming assignment, you will write a client pingprogram in Python. Your client will send a simple ping message to a server, receive a correspondingpong message back from the server, and determine the delay be ...

Sieve of eratosthenes in pythonthe goal is to find all the

Sieve of Eratosthenes (in Python) The goal is to find all the prime numbers less than or equal to some natural number maxn. We have a list that tells us if any of the numbers 0..maxn are "marked". It can be an array of b ...

Lab assignment -background - we have discussed in detail

Lab Assignment - Background - We have discussed, in detail, the function of Stacks and Queues and how they are specifically implemented in Python. To get a better understanding of the utility of these data structures, we ...

Homework -this homework will have both a short written and

Homework - This homework will have, both a short written and coding assignment. The problems that are supposed to be written are clearly marked. 1) (Written) Make heuristics Describe two heuristics for the slide problem ...

Question write a python program with a graphical user

Question: Write a python program with a graphical user interface that will allow a user to create a custom pizza which they wish to order. At minimum, the user should be able to choose the size of the pizza, the type of ...

Tasksdemonstrate data scraping of a social network of

Tasks Demonstrate data scraping of a social network of choice. Develop technical documentation, including the development of the code & detailing the results. Provide a report on the findings, that includes research into ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As