The Question below has been given to me:
An internet shop requires an order tracking system. When someone buys an item online, an Order is created. However, orders are not sourced and processed until payment has been confirmed. Once the order has been processed it can be shipped. The order is tracked until it has been delivered, at which point it is recorded as complete. Orders can be cancelled, but only before they are shipped.
Create an Order class. The Order class should have a constructor which takes 2 parameters: a tracking number and a timestamp. Implement 4 methods (pay, ship, complete, cancel). Each method should take 1 timestamp parameter. Also implement the standard "__str__" method to provide convenient a way of printing out the information in an Order.
Make sure the Order adheres to the business rules as outlined above: When Orders are created payment is unconfirmed. Orders must be paid before any other processing can occur. Orders cannot be shipped unless they are paid. Orders cannot be completed unless they are shipped. Orders cannot be cancelled after they have been shipped. The timestamp for each step in the business process (pay, ship, complete) must be greater than the timestamp for the previous step. Raise an exception if an invalid method call is made – that is if a call is made to a method while the Order is in the wrong state, of if the timestamp supplied in the method is less than or equal to the current timestamp.
Demonstrate that your Order class implements the methods requested, and adheres to the business rules as outlined above. Hint – stick to the requirements exactly as outlined.
then add save/load capabilities.
Where do i start? any help would be great!!!!