'Typed coursework 2 question'
[interests.git] / Documents / bookshop.cc
blob600158b34b715d66f39922adb3350335ca490fe7
1 // Copyright 2012 Carey Riley, Dwayne Reid
2 // A Bookshop Inventory Management System
3 /* A small Bookshop maintains the inventory of books sold in the shop. The list
4 * includes (but is not limited to) the following details:
5 * Author's name,
6 * Title of the book(s),
7 * Price of each each book,
8 * Publisher of each book,
9 * Stock levels of each type in a tabular form as shown below
10 * ----------------------------------------------------------------------
11 * | BOOKSHOP DATABASE |
12 * ------------------------------------------------------------------------
13 * | Author's Name | Book Title | Unit Price | Publisher | Stock Count |
14 * -----------------------------------------------------------------------
15 * | Deitel & Deitel| C++...Program| $2500.00| Pearson | 15 Copies |
16 * ------------------------------------------------------------------------
17 * | | | | | |
18 * ------------------------------------------------------------------------
20 * Whenever a customer wants a book, the sales person inputs the title and author
21 * and the system searches the list (database) and displays whether it is available
22 * or not. If available, the total cost of the requested copies is displayed;
23 * otherwise the message "Required copies not in stock" is displayed.
25 * Design a system using a class called books with suitable member functions,
26 * member variables and constructors. Use the New operator in your constructors
27 * to apportion possible memory requriements. Objects created in main should be
28 * able to access appropriate member functions to carry out whichever task(s) they
29 * are designed to perform.
31 * In writing your program, use comments to facilitate comprehension and explain
32 * all assumptions you might be forced to make for the system to function
33 * optimally. Innovation as well as user friendliness of your interface would be
34 * rewarded.
35 * /
37 #include <iostream>
38 #include <iomanip>
39 // #include <cstdio>
40 #include <string>
41 namespace {
42 using std::setfill;
43 using std::setw;
44 using std::cout;
45 void NotInStock(void) {cout << "Required copies not in stock\n";} // Response to not enough in stock
47 void PrintStockTableHeader(void) { // Stock Table Header
48 cout << setw(80) << setfill('_') << '\n' << setfill(' ') <<
49 '|' << setw(41) << "BOOKSHOP DATABASE" << setw(38) << '|' << '\n' <<
50 setw(80) << setfill('_') << '\n' << setfill(' ') <<
51 "| Author's Name |" <<
52 " Book Title |" <<
53 " Unit Price |" <<
54 " Publisher |" <<
55 " Stock Count|" << '\n' <<
56 setw(80) << setfill('_') << '\n' << setfill(' ');
59 BookSearch(std::string, std::string) {
61 class Books {
62 // public:
63 // Books(std::string ){
64 private:
65 std::string author_;
66 std::string title_;
67 double unitprice_;
68 std::string publisher_;
69 int quantity_;
72 int main() {
73 // NotInStock();
74 PrintStockTableHeader();