How do I write a command-line utility called assn4, in python, which will process operations init, purchase, change, and report.

How do I write a command-line utility called assn4, in python, which will process operations init, purchase, change, and report. Your program will store the drawer’s state in a local file, format of your choosing.

The cash register only works with $1’s, $5’s, $10’s, $20’s.

Change should always be made with the largest available denominations, and your program should handle the problems with running out of various denomination.

Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now

The major consideration with this assignment is to develop the unit tests to prove your software is robust and correct. Especially around the edge cases where the till is out of specific denominations.

Make sure the change command returns the correct total. Don’t return three tens in exchange for a twenty.

Descriptions of Subcommands

init amt = ones [fives [tens [twenties]]]

  • Initialise drawer, using counts of bills provided
  • If a drawer already exists, this will overwrite it. (Essentially, start a new shift.)
  • Output: None

purchase price = amount_tendered

  • price
  • Integer
  • amount_tendered
  • Number and type of bills given to register
  • ones [fives [tens [twenties]]], where amounts are integers (counts)
  • Output will be a single line, if successful:
  • change returned , where change returned has the same format: ones fives tens twenties

change tendered = bills_requested

  • tendered and bills_requested
  • ones [fives [tens [twenties]]], where amounts are integers (counts)
  • Output will be a single line, if successful:
  • change returned , where change returned has the same format: ones fives tens twenties

report

  • Output a single line, the total of the drawer, and a breakdown of the bills
  • sales : total = ones fives tens twenties
  • sales is the total of sales on the register, total is the total amount of money in the drawer, followed by the breakdown.

Example Output

$ # Initialize the till with a five dollar bills and ten ones.

"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!":

Get started