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

Info iconThis preview shows pages 1–2. 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 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 havent 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

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- Toronto.

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 Right Arrow Icon
Ask a homework question - tutors are online