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 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
|
#include <iostream>
#include <iomanip>
using namespace std;
void cashier(); // 1.
void invMenu(); // 4.
void report(); // 7.
void bookInfo(char *title[51],char *isbn[14],char *author[],char *publisher[],char *date[11],int quantity, double wholesale, double retail); // 10.
// 12.
void lookUpBook();
void addBook();
void editBook();
void deleteBook();
// 15.
void repListing();
void repWholesale();
void repRetail();
void repQty();
void repCost();
void repAge();
int searchList();
char bookTitle[20][51];
char isbn[20][14];
char author[20][31];
char publisher[20][31];
char dateAdded[20][11];
int qtyOnHand[20];
double wholesale[20];
double retail[20];
const double TAX_RATE=.06;
int main()
{
char choice;
//Task 4
cout << "\n\tABC Bookstore";
cout << "\n\t Main Menu ";
cout << "\n\n";
cout << "\n1. " << "Cashier Module";
cout << "\n2. " << "Inventory Base Module";
cout << "\n3. " << "Report Module";
cout << "\n4. " << "Exit";
cout << "\n\n";
cout << "\nEnter your choice :";
cin >> choice;
while(choice != '1' && choice != '2' && choice != '3' && choice != '4'){
cout << "\nEntries must be between 1 and 4 inclusively.";
cout << "\n\nEnter your choice :";
cin >> choice;
}
cout << "\nYou selected item " << choice;
cout << "\n\n";
switch(choice)
{
case '1' : // 3.
cashier();
break;
case '2' : // 6.
invMenu();
break;
case '3' : // 9.
report();
break;
}
system ("PAUSE");
return 0;
}
void cashier() // 2.
{
string date, isbn, title;
int quantity;
float price, subtotal,tax,total;
//get input
cout<<"Enter the Book's title: "<<endl;
getline(cin,title);
cout<<"Please enter the date: "<<endl;
cin>> date;
cout<<"Enter the quantity: "<<endl;
cin>>quantity;
cout<<"Enter the book's ISBN: "<<endl;
cin>>isbn;
cout<<"Enter the price of the book: "<<endl;
cin>>price;
//calculate total
subtotal=price*quantity;
tax= subtotal*.06;
total=tax+subtotal;
//Display cashier slip
cout<<"\t\tABC Bookstore\t\t"<<endl;
cout<<"Date: "<<date<<endl;
cout<<"\nQty \t ISBN \t\t Title \t\t Price \t Total"<<endl;
cout<<"____________________________________________________________"<<endl;
cout<<setw(2)<<quantity<<setw(15)<<isbn<<setw(20)<<title<<setw(8)<<price<<setw(8)<<subtotal<<endl;
cout<<"\n\n";
cout<<"\t\t\t\t\tSubtotal: $"<<subtotal<<endl;
cout<<"\t\t\t\t\tTax (6%): $"<<tax<<endl;
cout<<"\t\t\t\t\tTotal : $"<<total<<endl;
}
void invMenu() // 5.
{
char choice;
cout << "\n\t\tABC Bookstore";
cout << "\n\t Inventory Database Menu ";
cout << "\n\n";
cout << "\n1. " << "Look up a book";
cout << "\n2. " << "Add a book";
cout << "\n3. " << "Edit a book's record";
cout << "\n4. " << "Delete a book";
cout << "\n5. " << "Return to the main menu";
cout << "\n\n";
cout << "\nEnter your choice: ";
cin >> choice;
while( choice != '1' && choice != '2' && choice != '3' && choice != '4' && choice != '5' ){
cout << "\nEntries must be between 1 and 5 inclusively.";
cout << "\n\nEnter your choice :";
cin >> choice;
}
addBook();
cout << "\nYou selected item "<< choice;
cout << "\n\n";
}
void report() // 8.
{
char choice;
//Display menu
cout<<"\t\tABC Bookstore\t\t"<<endl;
cout<<"\t\tReports Menu\t\t"<<endl;
cout<<"\n\n";
cout<<"1. Inventory Listing"<<endl;
cout<<"2. Inventory Wholesale Value"<<endl;
cout<<"3. Inventory Retail Value"<<endl;
cout<<"4. Listing by Quantity"<<endl;
cout<<"5. Listing by Cost"<<endl;
cout<<"6. Listing by Age"<<endl;
cout<<"7.Return to Main Menu"<<endl;
//get choice
cout<<"Enter your choice: "<<endl;
cin>>choice;
//input validation
while(choice!='1' && choice!='2' && choice!='3' && choice!='4' && choice!='5' && choice!='6' && choice!='7')
{
cout<<"Entries must be between 1 and 9 inclusively."<<endl;
cout<<"Enter your choice: "<<endl;
cin>>choice;
}
//Display the entry made
cout<<"You selected item "<< choice<<endl;
}
//task 5
void bookInfo(char *title[51],char *isbn[14],char *author[],char *publisher[],char *date[11],int quantity, double wholesale, double retail) //11.
{
cout << "\t\tABC Bookstore";
cout << "\n\t\tBook Information";
cout << "\n\nISBN : ";
cout << "\nTitle : ";
cout << "\nAuthor : ";
cout << "\nPublisher : ";
cout << "\nDate Added : ";
cout << "\nQuantity on Hand : ";
cout << "\nWholesale Cost : ";
cout << "\nRetail Price : ";
cout << "\n\n";
}
// 13.
void lookUpBook()
{
cout << "this is look up book" << endl;
}
void addBook()
{
int bookResult = searchList();
if (bookResult == -1)
cout << "books cannot be added to inventory" << endl;
}
}
void editBook()
{
cout << "this is edit book" << endl;
}
void deleteBook()
{
cout << "this is delete book" << endl;
}
// 16.
void repListing()
{
cout << "this is rep listing" << endl;
}
void repWholesale()
{
cout << "this is rep wholesale" << endl;
}
void repRetail()
{
cout << "this is rep retail" << endl;
}
void repQty()
{
cout << "this is rep qty" << endl;
}
void repCost()
{
cout << "this is rep cost" << endl;
}
void repAge()
{
cout << "this is rep age" << endl;
}
int searchList()
{
int position = -1;
int index = 0;
while (index < 20)
{
if (bookTitle[index][0] == 0)
{
position = index;
break;
}
index++;
}
return position;
}
|