multiple transaction/stub functions.

I am so entirely confused. I have a really messy/basic outline but I'm not sure where to go from here. Any and all input is greatly appreciated! Sorry it's kinda lengthy but here are the requirements:

1. Multiple Transactions: After the data is entered, the function should ask if there are other titles being purchased. If so, allow user to enter data for another book. If not, calculate sale subtotal, tax, and total.

2. Enable Automatic Lookup: Once user enters the ISBN number, it automatically looks up the book title and price. It can do so by searching for the ISBN number in the isbn array, then pulling the title from bookTitle array and price from the retailarray. If the function cannot locate ISBN number in isbn array, it should display a message indicating so. Should then ask user if they want to re-enter the number and let user enter that number again.

Once a book’s data has been retrieved, function should check the qtyOnHand array to determine whether there are enough copies in stock to fill the order. If so, function should subtract the number of copies being purchased from the amount in the array. Else, function should display a message indicating so then return to the main menu.

3. Complete Stub Functions Called from the Reports Menu:
List of reporting functions and what they do:

The repListing function should display a report listing all the books in the inventory. The function should fill the screen with data and then ask the user to press a key to continue to the next screen.

The repWholesalefunction should display a report that lists the following data on all books in the inventory: title, ISBN number, quantity on hand, and wholesale const.

The repRetailfunction should display a report that lists the following data on all books in the inventory: title, ISBN , quantity, and retail price.

The repQty function should display a report that lists the following data on all books in the inventory: title, ISBN and quantity on hand.

The repCost function should display a report that lists the following data on all books in the inventory: title, ISBN, quantity, and wholesale cost.

The repAge function display list of data on all books in the inventory. title, ISBN, quantity, and date added to inventory.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;

const int SIZE = 20;

//external declarations
extern string bookTitle[SIZE];
extern string isbn[SIZE];
extern string author[SIZE];
extern string publisher[SIZE];
extern string dateAdded[SIZE];
extern int qtyOnHand[SIZE];
extern double wholesale[SIZE];
extern double retail[SIZE];

void cashier()
{
	const double SALES_TAX	= 0.06;	

	char again; //To hold Y or N input
	string	isbnNumber[SIZE];		
	string	thisTitle [SIZE];		

	int	quantityBooks[SIZE];	
	double	unitPrice [SIZE];	
	double	subTotal [SIZE]; // total of the each order before sales tax
	string	transDate;

	double	orderSalesTax	= 0;
	double	runningTotal	= 0;
	double	grandTotal	= 0; // the subtotal + sales tax
	int	validQty	= 0; // stores quantity of a book before user input
	int	choice		= 0; // stores users choice
	int	counter		= 0; // counts each new book ordered

// 'Process Another Transaction' repeats the program until item 2 is selected
	while(choice != 2)
	{
		counter = 0;
		// display company name and screen title
		cout << "Welcome to The Bookstors.\n";
		cout << "\nDate of purchase: ";
		cin >> dateAdded;

// 'Add Another Title' repeats the program until item 2 is selected
		while(choice != 2)
		{
// 'Re-enter ISBN Number' re-enter the ISBN number until item 2 is selected
			while(choice != 2)
			{
// prompt the user to enter an ISBN number
				cout << "Please enter the ISBN number: /n";
				cin >> isbnNumber;

// enter the 'search for isbn number' for loop

// store book information in local variables
// store quantity before input
// prompt the user to enter quantity of books
				cout << "\nQuantity of Books: ";
                                cin >> quantityBooks;

// validate user's input
					while(quantityBooks[counter] < 1)
					{

					}

// quantity requested is in inventory
					if(quantityBooks[counter] <= qtyOnHand[index])
					{
// remove the quantity requested from inventory

					}
// quantity requested is not in inventory
					else if(quantityBooks[counter] > qtyOnHand[index])
					{
// decrement the counter
// restore quantity before input
return;
					}

// prompt the user to add another title
					cout << "\nAdd another title to this order?\n";
					cout << "1. Yes\n";
					cout << "2. No\n\n";

					cout << "Enter Your Choice: ";
					cin	 >> choice;
					cin.ignore();

					counter++;

					cout << endl;
// validate user's input
					while (choice != 1 && choice != 2)
					{
						cout << "\nPlease enter a number in the range 1 - 2.\n\n";

						cout << "\nAdd another title to this order?\n";
						cout << "1. Yes\n";
						cout << "2. No\n\n";

						cout << "Enter Your Choice: ";
						cin	 >> choice;
						cin.ignore();
					}

					break;

				}

				else if(index == SIZE - 1)
				{
					cout << "\nISBN number was not found.\n\n";

					cout << "Re-enter ISBN number?\n";
					cout << "1.Yes\n";
					cout << "2.No\n\n";

					cout << "Enter Your Choice: ";
					cin	 >> choice;
					cin.ignore();

// validate user's input
					while (choice != 1 && choice != 2)
					{
						cout << "\nPlease enter a number in the range 1 - 2.\n\n";

						cout << "\nRe-enter ISBN number?\n";
						cout << "1. Yes\n";
						cout << "2. No\n\n";

						cout << "Enter Your Choice: ";
						cin >> choice;
						cin.ignore();
					}
				}
			}
			cout << endl;
		}
	}

		if( counter > 0)
		{
// display company name
		cout << "\n\nBookstore\n\n";

// display date
		cout << "Date: "
		<< transDate
		<< "\n\n";

// display headings
		cout << "Qty\tISBN\t\tTitle\t\t\t\tPrice\t\tTotal\n";
		cout << "________________________________________";
		cout << "________________________________________";
		cout << "\n";

// enter the 'Display Information' for loop
		for (int i = 0; i < counter; i++)
		{
// perform the calculations
		subTotal[i] = (quantityBooks[i] * unitPrice[i]);
		orderSalesTax += (subTotal[i] * SALES_TAX);
		runningTotal  +=  subTotal[i];
		grandTotal = (orderSalesTax + runningTotal);

// display order information
		cout << fixed
		<< showpoint << right << setprecision(2);
                cout << quantityBooks[i] << "\t";

		cout << left << setw(14) << isbnNumber[i] << "\t";

		cout << left << setw(26) << thisTitle[i] << "\t$ ";

		cout << fixed << showpoint << right;

		cout << setw(6) << unitPrice[i] << "\t$ ";

		cout << setw(6) << subTotal[i];

		}

		cout << "\n\n\n";

	// display footer information
		cout << "\t\t\tSubtotal\t\t\t\t\t$ "
		<< setw(6) << setprecision(2) << fixed
                << runningTotal << "\n";

		cout << "\t\t\tTax\t\t\t\t\t\t$ "
		<< setw(6) << setprecision(2) << fixed << orderSalesTax << "\n";

			cout << "\t\t\tTotal\t\t\t\t\t\t$ "
				 << setw(6)
				 << setprecision(2)
				 << fixed
				 << grandTotal
				 << "\n\n";

			cout << "Thank You for Shopping at The Bookstore!\n";

			cout << endl;

			}

// prompt the user to enter another transaction
	cout << "\nProcess another transaction?\n";
	cout << "1. Yes\n";
	cout << "2. No\n\n";

	cout << "Enter Your Choice: ";
	cin >> choice;

// validate user's input
	while (choice != 1 && choice != 2)
	{
		cout << "\nProcess another transaction?\n";
		cout << "1. Yes\n";
		cout << "2. No\n\n";

		cout << "Enter Your Choice: ";
		cin  >> choice;
		}
	}
	cout << endl;
}
Please do not cross-post the same problem:
http://www.cplusplus.com/forum/beginner/138533/

Topic archived. No new replies allowed.