Site hosted by Angelfire.com: Build your free website today!

The Database, Valentine Store, and that Business shit

click here to download the .cpp file

//this is the user database
//the users are:
//* Khanh Dang
//* Javier Martinez
//* Siridath Rath
//* Andrew Perez
//* Mustafa Sheikhani

#include <iostream>
#include <conio.h>
using namespace std;
void main ()
{
//***DATABASE VARIABLES***
char firstname[5][9] = {"Khanh", "Javier", "Siridath", "Andrew", "Mustafa"};
char lastname[5][10] = {"Dang", "Martinez", "Rath", "Perez", "Sheikhani"};
char address[5][20] = {"123 Anystreet", "1st Second St.", "Right Next Door St.", "Elm St.", "Abby Road"};
char city[5][14] = {"Long Beach", "Lynwood", "Long Beach", "Long Beach", "Mission Viejo"};
char state[5][3] = {"CA", "CA", "CA", "CA", "CA"};
int zip[5] = {90805, 90210, 90713, 90806, 90001};
int ID[5] = {1, 2, 3, 4, 5};
int dummyID = 0;
int password[5][11] = {1, 22, 333, 4444, 55555};
int dummypassword = 0;
int credit[5] = {5000, 500, 500, 100, 1000000};
int dummycredit = 0;

//***VALENTINE VARIABLES***
int buyselection = 0;
int itemcount[10] = {0};
int buytotal = 0;

//***BUSINESS VARIABLES***
float sales[6] = {0};

//this is the user database
//the users are:
//* Khanh Dang
//* Javier Martinez
//* Siridath Rath
//* Andrew Perez
//* Mustafa Sheikhani

//DATABASE
//prompts user to enter ID and password & loops if incorrect inputs
while (dummyID < 1 || dummyID > 5)
{

cout<<"Please enter your ID number: ";cin>>dummyID;
cout<<endl;
switch (dummyID)
{
case 1: cout<<"Oh, hello Khanh";cout<<endl;break;
case 2: cout<<"Oh, hello Javier";cout<<endl;break;
case 3: cout<<"Oh, hello Siridath";cout<<endl;break;
case 4: cout<<"Oh, hello Andrew";cout<<endl;break;
case 5: cout<<"Oh, hello Mustafa";cout<<endl;break;
default: cout<<"Your ID was incorrect, please re-enter!";cout<<endl;
}
}
while (dummypassword != 1 && dummypassword != 22 && dummypassword != 333 &&
dummypassword != 4444 && dummypassword != 55555)
{
cout<<"Please enter your password: ";cin>>dummypassword;
cout<<endl;

switch (dummypassword)
{
case 1: cout<<"Password cleared Khanh";cout<<endl;break;
case 22: cout<<"Password cleared Javier";cout<<endl;break;
case 333: cout<<"Password cleared Siridath";cout<<endl;break;
case 4444: cout<<"Password cleared Andrew";cout<<endl;break;
case 55555: cout<<"Password cleared Mustafa";cout<<endl;break;
default: cout<<"Your password was incorrect, please re-enter!";cout<<endl;
}
}
cout<<endl;


//***VALENTINE STORE***
cout<<"Now, onto the Valentine Store!\n";
cout<<endl;

//this puts the users credit limit onto the screen
switch (dummyID)
{
case 1: cout<<"Your credit limit is $"<<credit[0];cout<<endl;break;
case 2: cout<<"Your credit limit is $"<<credit[1];cout<<endl;break;
case 3: cout<<"Your credit limit is $"<<credit[2];cout<<endl;break;
case 4: cout<<"Your credit limit is $"<<credit[3];cout<<endl;break;
case 5: cout<<"Your credit limit is $"<<credit[4];cout<<endl;break;
default: cout<<"Your ID was incorrect, please re-enter!";cout<<endl;
}

//lets user choose what they want to buy
while (buyselection != 99)
{
cout<<"Please select what you want to buy:\n";
cout<<"(you can buy by pressing the number corresponding to the item)\n";
cout<<endl;
cout<<"1. Teddy Bear $ 10\n";
cout<<"2. Teddy Bear w/Heart $ 15\n";
cout<<"3. Big Heart Pillow $ 25\n";
cout<<"4. Heart Shaped Box of chocolates $ 20\n";
cout<<"5. Big Ole Red Convertable $ 30000\n";
cout<<"6. Singing Telegram $ 30\n";
cout<<"7. Singing Telegram w/Flowers $ 50\n";
cout<<"8. Bouquet of 12 Red Roses $ 30\n";
cout<<"9. Happy Valentine's Day Card $ 1\n";
cout<<"10. CD of Valentine Love Songs $ 5\n";
cout<<"99. DONE\n";
cout<<endl;
cout<<"Your selection: ";cin>>buyselection;
cout<<endl;

//decides which balance to use
if (dummypassword == 1)
dummycredit = 5000;

if (dummypassword == 22)
dummycredit = 500;

if (dummypassword == 333)
dummycredit = 500;

if (dummypassword == 4444)
dummycredit = 100;

if (dummypassword == 55555)
dummycredit = 1000000;

//depending on what the user inputs, this counts the quantity per item
//and adds to their total
switch (buyselection)
{
case 1: ++itemcount[0];buytotal += 10;break;
case 2: ++itemcount[1];buytotal += 15;break;
case 3: ++itemcount[2];buytotal += 25;break;
case 4: ++itemcount[3];buytotal += 20;break;
case 5: ++itemcount[4];buytotal += 30000;break;
case 6: ++itemcount[5];buytotal += 30;break;
case 7: ++itemcount[6];buytotal += 50;break;
case 8: ++itemcount[7];buytotal += 30;break;
case 9: ++itemcount[8];buytotal += 1;break;
case 10: ++itemcount[9];buytotal += 5;break;
case 99: cout<<"Your total spent is $"<<buytotal;cout<<endl;
cout<<"Your remaining balance is $";cout<<dummycredit - buytotal;cout<<endl;
break;
default: cout<<"**You have selected an invalid choice, please try again.**\n";
}

//if the user has gone over their credit limit a message appears
if (buytotal > credit[0] && dummypassword == 1)
cout<<"You have gone over your limit, your limit is $"<<credit[0];

if (buytotal > credit[1] && dummypassword == 22)
cout<<"You have gone over your limit, your limit is $"<<credit[1];

if (buytotal > credit[2] && dummypassword == 333)
cout<<"You have gone over your limit, your limit is $"<<credit[2];

if (buytotal > credit[3] && dummypassword == 4444)
cout<<"You have gone over your limit, your limit is $"<<credit[3];

if (buytotal > credit[4] && dummypassword == 55555)
cout<<"You have gone over your limit, your limit is $"<<credit[4];
cout<<endl;

//decides what info to display
if (dummypassword == 1)
cout<<firstname[0],cout<<" ",cout<<lastname[0],
cout<<endl,
cout<<address[0],
cout<<endl,
cout<<city[0],cout<<", ",cout<<state[0],cout<<" ",cout<<zip[0];

if (dummypassword == 22)
cout<<firstname[1],cout<<" ",cout<<lastname[1],
cout<<endl,
cout<<address[1],
cout<<endl,
cout<<city[1],cout<<", ",cout<<state[1],cout<<" ",cout<<zip[1];

if (dummypassword == 333)
cout<<firstname[2],cout<<" ",cout<<lastname[2],
cout<<endl,
cout<<address[2],
cout<<endl,
cout<<city[2],cout<<", ",cout<<state[2],cout<<" ",cout<<zip[2];

if (dummypassword == 4444)
cout<<firstname[3],cout<<" ",cout<<lastname[3],
cout<<endl,
cout<<address[3],
cout<<endl,
cout<<city[3],cout<<", ",cout<<state[3],cout<<" ",cout<<zip[3];

if (dummypassword == 55555)
cout<<firstname[4],cout<<" ",cout<<lastname[4],
cout<<endl,
cout<<address[4],
cout<<endl,
cout<<city[4],cout<<", ",cout<<state[4],cout<<" ",cout<<zip[4];

cout<<endl;
cout<<endl;

//outputs items purchased, quantity, and price
if (itemcount[0] > 0)
cout<<"You purchased ",cout<<itemcount[0],cout<<" Teddy Bear(s) at $10 each\n";
if (itemcount[1] > 0)
cout<<"You purchased ",cout<<itemcount[1],cout<<" Teddy Bear(s) w/Heart at $15 each\n";
if (itemcount[2] > 0)
cout<<"You purchased ",cout<<itemcount[2],cout<<" Big Heart Pillow(s) at $25 each\n";
if (itemcount[3] > 0)
cout<<"You purchased ",cout<<itemcount[3],cout<<" Box(es) of Chocolates at $30 each\n";
if (itemcount[4] > 0)
cout<<"You purchased ",cout<<itemcount[4],cout<<" Red Convertable(s) at $30000 each\n";
if (itemcount[5] > 0)
cout<<"You purchased ",cout<<itemcount[5],cout<<" Singing Telegram(s) at $30 each\n";
if (itemcount[6] > 0)
cout<<"You purchased ",cout<<itemcount[6],cout<<" Singing Telegram(s) w/Flowers at $50 each\n";
if (itemcount[7] > 0)
cout<<"You purchased ",cout<<itemcount[7],cout<<" Dozen Red Roses at $30 each\n";
if (itemcount[8] > 0)
cout<<"You purchased ",cout<<itemcount[8],cout<<" Valentine Card(s) at a $1 a piece\n";
if (itemcount[9] > 0)
cout<<"You purchased ",cout<<itemcount[9],cout<<" Valentine CD(s) at $5 each\n";
}
cout<<endl;

//business portion
cout<<"Welcome to the DeVRY Money Leechers Inc.\n";
cout<<endl;
cout<<"You will be entering the sales per region to calculate the\n";
cout<<"national total. The regions will be: Los Angeles, Seattle, Texas,\n";
cout<<"North Dakota, Florida, and New York.\n";
cout<<"(NOTE! Sales must not be less than $1000000)\n";
cout<<endl;

//prompts user to enter values for each region
while (sales[0] < 1000000)
{
cout<<"Please enter the sales for Los Angeles: ";cin>>sales[0];
}

while (sales[1] < 1000000)
{
cout<<"Please enter the sales for Seattle: ";cin>>sales[1];
}

while (sales[2] < 1000000)
{
cout<<"Please enter the sales for Texas: ";cin>>sales[2];
}

while (sales[3] < 1000000)
{
cout<<"Please enter the sales for North Dakota: ";cin>>sales[3];
}

while (sales[4] < 1000000)
{
cout<<"Please enter the sales for Florida: ";cin>>sales[4];
}

while (sales[5] < 1000000)
{
cout<<"Please enter the sales for New York: ";cin>>sales[5];
}

cout<<endl;

//calculating comission
while (sales[0] > 1000000 && sales[0] < 2000000 ||
sales[1] > 1000000 && sales[1] < 2000000 ||
sales[2] > 1000000 && sales[2] < 2000000 ||
sales[3] > 1000000 && sales[3] < 2000000 ||
sales[4] > 1000000 && sales[4] < 2000000 ||
sales[5] > 1000000 && sales[5] < 2000000)
{
sales[x] *= .005
}
cout<<sales[0];


}

NOTE!!! Not finished!!!