August 2012
Intermediate to advanced
976 pages
30h 17m
English
Sales_data ClassUnlike the Sales_item class, our Sales_data class does not provide any operations. Users of Sales_data have to write whatever operations they need. As an example, we’ll write a version of the program from § 1.5.2 (p. 23) that printed the sum of two transactions. The input to our program will be transactions such as
0-201-78345-X 3 20.000-201-78345-X 2 25.00
Each transaction holds an ISBN, the count of how many books were sold, and the price at which each book was sold.
Sales_data ObjectsBecause Sales_data provides no operations, we will have to write our own code to do the input, output, and addition ...
Read now
Unlock full access