//Internet Store
//By Alan Shum
#include <iostream.h>
int b; //graphics card selection
int c=0; //graphics card quantity
int d; //Processor selection
int e=0; //Processor quantity
int f; //hard drive selection
int g=0; //hard drive quantity
int h; //RAM selection
int i=0; //RAM quantity
int a; //main menu choice
int j; //return back to beginning
int yn; //checkout: remove things in cart.
char takeout; //take out an item.
int shipment; //shipment method
double weight=0; //total weight so far
double money=0; //how much money to be paid before taxes
void selection_made();
void selection_made()
{
if (a==1)
{
switch (b)
{
case 1:
money=money+(109.95*c);
weight=weight+(1.2*c);
break;
case 2:
money=money+(548.98*c);
weight=weight+(1.4*c);
break;
case 3:
money=money+(149.99*c);
weight=weight+(1.1*c);
break;
case 4:
money=money+(999.98*c);
weight=weight+(1.9*c);
break;
default:
cout<<"Incorrect answer. Enter 5 to return to main menu.\n";
cin>>b;
break;
}
}
if (a==2)
{
switch (d)
{
case 1:
money=money+(229.99*e);
weight=weight+(0.2*e);
break;
case 2:
money=money+(989.95*e);
weight=weight+(0.3*e);
break;
case 3:
money=money+(294.50*e);
weight=weight+(0.3*e);
break;
case 4:
money=money+(1000.99*e);
weight=weight+(0.5*e);
break;
default:
cout<<"Incorrect answer. Enter 5 to return to main menu.\n";
cin>>b;
break;
}
}
if (a==3)
{
switch (f)
{
case 1:
money=money+(84.95*g);
weight=weight+(2.3*g);
break;
case 2:
money=money+(261.99*g);
weight=weight+(2.4*g);
break;
case 3:
money=money+(200.99*g);
weight=weight+(1.9*g);
break;
case 4:
money=money+(385.97*g);
weight=weight+(1.8*g);
break;
default:
cout<<"Incorrect answer. Enter 5 to return to main menu.\n";
cin>>b;
break;
}
}
if (a==4)
{
switch (h)
{
case 1:
money=money+(20.99*h);
weight=weight+(0.15*h);
break;
case 2:
money=money+(44.95*h);
weight=weight+(0.25*h);
break;
case 3:
money=money+(51.99*h);
weight=weight+(0.35*h);
break;
default:
cout<<"Incorrect answer. Enter 5 to return to main menu.\n";
cin>>b;
break;
}
}
}
int main()
{
cout<<"Welcome to the Computer Store!\n";
cout<<"What would you like to buy?\n";
do
{
cout<<"Main Menu:\n";
cout<<"1 - Graphics Cards\n";
cout<<"2 - Processors\n";
cout<<"3 - Hard Drives\n";
cout<<"4 - RAM\n";
cout<<"5 - View Cart\n";
cout<<"6 - Exit Store or Checkout\n";
cout<<"Current amount owed before taxes: $"<<money<<".\n";
cout<<"Current weight: "<<weight<<" lbs.\n";
cout<<"Choose a selection.\n";
cin>>a;
switch (a)
{
case 1:
cout<<"Graphics Cards\n";
cout<<"1 - Radeon 7750:............$109.95\n";
cout<<"2 - Radeon 7970:............$548.98\n";
cout<<"3 - Nvidia Geforce 550:.....$149.99\n";
cout<<"4 - Nvidia Geforce 690:.....$999.98\n";
cout<<"5 - Return to main menu.\n";
cout<<"Which selection do you want?\n";
cin>>b;
if(b==5)
{
j=1;
break;
}
if((b>5)||(b<1))
{
cout<<"Incorrect Response. Returning to main menu.\n";
j=1;
break;
}
cout<<"How many do you want?\n";
cin>>c;
selection_made();
break; //make sure to loop it back later
case 2:
cout<<"Processors\n";
cout<<"1 - AMD Opteron 1385:........$229.99\n";
cout<<"2 - AMD Opteron 2435:........$989.95\n";
cout<<"3 - Core i7 2600K:...........$294.50\n";
cout<<"4 - Core i7 3960X:...........$1000.99\n";
cout<<"5 - Return to main menu.\n";
cout<<"Which selection do you want?\n";
cin>>d;
if(d==5)
{
j=1;
break;
}
if((d>5)||(d<1))
{
cout<<"Incorrect Response. Returning to main menu.\n";
j=1;
break;
}
cout<<"How many do you want?\n";
cin>>e;
selection_made();
break; //make sure to loop it back later AND ADD WEIGHT!!!!
case 3:
cout<<"Hard Drives\n";
cout<<"1 - Crucial 64 GB SSD:.......$84.95\n";
cout<<"2 - Crucial 256 GB SSD:......$261.99\n";
cout<<"3 - Western 1 TB HD:.........$200.99\n";
cout<<"4 - Western 2 TB HD:.........$385.97\n";
cout<<"5 - Return to main menu.\n";
cout<<"Which selection do you want?\n";
cin>>f;
if(f==5)
{
j=1;
break;
}
if((f>5)||(f<1))
{
cout<<"Incorrect Response. Returning to main menu.\n";
j=1;
break;
}
cout<<"How many do you want?\n";
cin>>g;
selection_made();
break; //make sure to loop it back later
case 4:
cout<<"RAM\n";
cout<<"1 - Crucial 2 GB RAM:........$20.99\n";
cout<<"2 - Crucial 4 GB RAM:........$44.95\n";
cout<<"3 - Crucial 8 GB RAM:........$51.99\n";
cout<<"4 - Return to main menu.\n";
cout<<"Which selection do you want?\n";
cin>>h;
if(h==4)
{
j=1;
break;
}
if((h>4)||(h<1))
{
cout<<"Incorrect Response. Returning to main menu.\n";
j=1;
break;
}
cout<<"How much RAM do you want?\n";
cin>>i;
selection_made();
break; //make sure to loop it back later
case 5:
cout<<"Shopping Cart\n";
cout<<"Books: Quantity: Cost:\n";
cout<<"Would you like to remove anything from your cart (y/n)?\n";
cin>>yn;
cout<<"Which item do you want to take out?\n";
cin>>takeout;
break;
case 6:
cout<<"Shipping method\n";
cout<<"1 - Carrier Pidgeon:(Takes 10-15 business days. Based on 0.99/lb.\n";
cout<<"2 - Truck:(Takes 3-4 business days. Based on 0.5/lb.\n";
cout<<"3 - Overnight Air Shipment:(Takes 1 business day. Based on 0.25/lb.\n";
cout<<"What kind of shipment method do want?\n";
cin>>shipment;
break;
}
}
while (j=1);
return 0;
}