//Reads input from user to determine different discounts by number of units sold
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
//Declaration and Initialization of variables
int quantity;
double discount,price = 99.00,totalCost;
//gets input and checks for valid input
cout << "How many units were bought?";
cin >> quantity;
if (quantity <=1)
{
discount = 0;
}
else((quantity >= 1 ) && (quantity <10))
{// error expecting a ;
discount = 1;
}
else((quantity >= 10) && (quantity <20))
{
discount = 2;
}
else((quantity >= 20) && (quantity <50))
{
discount = 3;
}
else((quantity >= 50) && (quantity <100))
{
discount = 4;
}
else((quantity >=100))
{
discount = 5;
}
switch(discount){
case 0:
cout << "Invalid input. Please enter a valid number.";
break;
case 1:
cout << "There is no discount. Your final price is " << quantity*price<< endl;
cout << "Thank you!" << endl;
break;
case 2:
cout << "Your final price with a 20% discount is " << quantity*price*(.8)<<endl;
cout << "Thank you!" << endl;
break;
case 3:
cout << "Your final price with a 40% discount is " << quantity*price*(.7)<<endl;
cout << "Thank you!" << endl;
break;
case 4:
cout << "Your final price with a 60% discount is " << quantity*price*(.6)<<endl;
cout << "Thank you!" << endl;
break;
case 5:
cout << "Your final price with a 50% discount is " << quantity*price*(.5)<<endl;
cout << "Thank you!" << endl;
break; //error here "Not recognizing the being in a break statement
}
} //error here "Expected a declaration