{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

180-a1 - CSC180 Introduction to Computer Programming...

This preview shows pages 1–2. Sign up to view the full content.

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

View Full Document
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 1 Due: 11:59 PM, October 6, 2008 1 Problem description Simulate the receipt machine at the U of T Bookstore. Prices are only allowed to be an integral number of cents. You must define the functions in Section 2 using exact function prototypes. Hint: use global variables. This assignment is worth 4% toward your final grade. 2 Function prototypes • void init(char c); Initialize the receipt machine for a customer. This function sets the num- ber of items purchased by the customer to 0, subtotal price (price before tax) to 0, and tax type to c , where c can be ’g’ or ’G’ (GST), ’p’ or ’P’ (PST), ’b’ or ’B’ (both GST and PST), or any other character (tax free). Let GST be 5%, and PST be 8%. • void purchase(int q, double p); Purchase q items, each with price p (in CA dollars). • void cancel(int q, double p); Cancel q items, each with price p . cancel() would work even if you try to cancel items that haven’t been bought yet. However, note that cancel() must not make the number of items purchased negative, nor make subtotal price negative. (See Section 4 for more information.) Any attempts to violate this requirement will have no effects.attempts to violate this requirement will have no effects....
View Full Document

{[ snackBarMessage ]}

Page1 / 4

180-a1 - CSC180 Introduction to Computer Programming...

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

View Full Document
Ask a homework question - tutors are online