a3 - CSC180 Introduction to Computer Programming Assignment...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CSC180 Introduction to Computer Programming Assignment 3 Due: 11:59 PM, November 24, 2008 1 Problem description Improve the receipt machine in the assignment 2. The program can process multiple transactions from a transaction file and print multiple receipts. The items on the receipts can be sorted by name, price, or quantity, in increasing order or decreasing order. This assignment is worth 6% toward your final grade. A transaction file, e.g., trans.txt , has the following format: TRANSACTION:K0123456789-7:53 01/11/08 09:25 C Programming A Modern Approach:98.75:2:p Molecular Biology of the Cell:152.57:1:G C Programming A Modern Approach:98.75:3:p PAYMENT:mc:1234567887654321:500 TRANSACTION:K0123456789-8:202 09/09/08 12:00 TRANSACTION:K0000246871-7:263 10/08/07 14:25 Highlighter:4.99:2:b Diablo Pad Holder:29.99:1:N Agenda:5.99:1:g PAYMENT:cash:50.25 trans.txt contains three transactions, each beginning with the reserved word TRANSACTION . A transaction consists of two mandatory lines, followed by, in order, zero or more item lines, and zero or one payment line. The two mandatory lines are the transaction ID line and the transaction time line. The transaction ID line has three fields: TRANSACTION , a unique transaction ID (e.g., K0123456789-7 ), and cashier ID (e.g., 53). The transaction ID begins with a capital letter, followed by ten digits, a dash, and one digit. The time line shows 1 transaction time in the format dd/mm/yy hh:mm . The item line has four fields: item name, price, quantity, and tax type. All item names contain no colons and do not begin with any reserved word ( TRANSACTION or PAYMENT ). Acceptable values of price, quantity, and tax type are described in the assignment 2. The payment line begins with the reserved word PAYMENT , followed by a payment option, a 16-digit card number (present if and only if the payment was done using cards), and payment amount. Acceptable payment options are "debit" (Debit Card), "mc" (Master Card), "vc" (Visa Card), and "cash" . Each transaction allows only one payment option. Each field is present, and neighboring fields are separated by a colon. There are no empty lines, which only contain whitespace characters. There are no leading whitespace characters on each line. A transaction file may contain zero or more transactions. Assume that a transaction file is always valid. Suppose the program name is receipt . Its usage is shown below. Typing either ./receipt or ./receipt -h prints the following usage information: Usage: ./receipt [OPTION] [FILE]-a TEMP append TEMP to FILE-d id[,item] delete a transaction or an item-f id find a transaction-k >t|<t|=t delete transactions happened after, before or at time t-p print receipts-r 0|1|2 specify sort criterion-s 0|1 specify sort order-h this message Given trans.txt , typing the command ./receipt -p trans.txt prints the following receipts: Welcome to U of T Bookstore Koffler Student Services Bldg....
View Full Document

This note was uploaded on 01/10/2011 for the course CSC 180 taught by Professor Na during the Fall '01 term at University of Toronto.

Page1 / 14

a3 - CSC180 Introduction to Computer Programming Assignment...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online