Next page | Contents page |

Exercise 29 - OrderCode

Write the OrderCode class described on the previous page, given that your company wants the format of the order to be yymmdd-nnnn, where yy are the last two digits of the year when the order was created, mm the 2 digits of the month (01..12), dd the 2 digits of the day, nnnn the sequence number for orders on that day (starting at 0001).

How will you reset the sequence number each day?

Test it using a main () method as a test harness.

Integrate it with the classes from Exercise 22 (Product, Catalogue, Order). Also make another class having a repository for orders as they are created, from which they can be retrieved again.

Go on to make a GUI front end for this ordering system. NB: Keep the front end quite separate from the ordering system itself; then a web front end could be substituted. (The standard design pattern is MVC - Model, View, Controller - but we will not go into that in this course. Look it up on the web.)

Next page | Contents page |