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

  Output the starting position and length

X Strings: Input a string. Output the starting position and length of the first occurrence of the longest substring of capital Xs in that string. The first letter is in position 1.

  Console program where you will implement

Create a console program where you will implement coding constructs and variables that are needed for this program and will implement the code within Main and any required static methods.

  The integers should be printed in order with addresses

The integers should be printed in order with addresses from main. When the steps of the function order have been completed the smallest value will be stored in a, the middle in b, and the largest in c.

  Write a program to receive a series of numbers

Write a program to receive a series of numbers (including decimal) from the user until enter key is pressed. Process the input data and display number count, sum and average. Use proper data type and format.

  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.

  1 one factor that leads to a decline in biodiversity is the

1. one factor that leads to a decline in biodiversity is the introduction of non-native species. however most species

  Write a program that will open a blastn

Write a program that will open a BLASTN (nucleotide to nucleotide search) output file, parse out specific information, and produce formatted output that will be written to STDOUT

  Q1if we knew all the ecological social and competitive

q1if we knew all the ecological social and competitive forces that regulate populations and in reality we couldnt what

  Write a program that obtains integer numbers from user

Emphasize standard approaches that verify you have successfully mastered the concepts of structured design - selects a menu item, program should perform calculation, display the result to the user, and return to the main menu.

  Improve the code for the haunted house game

Improve the readability of the code by improving the function names, variables, and loops, as well as whitespace. Document these changes in your journal and define a win condition for the game, for example, collecting all items and returning to the..

  Write a program using the ''requetinteger''

using python/jython programming write a program using the 'requetInteger' function that will ask the user to type a value that will draw a line from one point on a picture to another. I don't need specific help just a gerneral idea.

  Fill in the python code

Fill in the Python code to play Tic Tac Toe. I won't award points unless it runs succesfully. # Tic-Tac-Toe Game def drawBoard(board): # Draws the board using the list of numbers print(" ") print(" ",board[0]," | ",board[1]," | ", board[2]) print("--..

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