Respuesta :
Answer:
The explanation of this program is given below. This program is written in C++ using dev C++
Explanation:
#include <iostream>
using namespace std;
int main()
{ double hotWings=0;//hot wings quantity
double sweetWings=0;// sweet wings quanity
double sourWings=0;// sour wings quanity
double wingPrice=0.50;// wing prices
int wingType=0;//wing type- prompt user to enter wing type
double discount=0.0;// discount
double discountRate=0.0;// discount rate for different wings quanity
double subTotal=0.0;// subtotal wings quantity multiply wing price
string input;
cout<<"Enter the type of Wing 1-for-Hot wings, 2-for-sweet wing and 3-for-sour wing ";// prompt user for input
cin>>wingType;
while(wingType!=4)// while loop until user quit the purchasing
{
switch(wingType)// in the while, decide what type of wing user purchasing
{
case 1:// if user purchase hot wing
cout<<"\nEnter the Quantity ";
cin>>hotWings;
break;
case 2:// if user purchase sweet wings
cout<<"\nEnter the Quantity ";
cin>>sweetWings;
break;
case 3://if user purchase sour wings
cout<<"\nEnter the Quantity ";
cin>>sourWings;
break;
}
if ((hotWings+sweetWings+hotWings)>24)// if all wings is greater than 24
{
discountRate=0.25;// then discount is 25 %
cout<<"\nDiscount Rate "<<(discountRate *100)<<"%"; //print discount rate
subTotal=(hotWings+sweetWings+hotWings) * wingPrice;// subtotal
cout<<"\nSubtotal: "<<subTotal;// print subtotal
cout<<"\nDiscount:"<<subTotal * discountRate;// print discount on subtotal
cout<<"\nTotal: "<<(subTotal-(subTotal * discountRate));// print after discount
}
else if(hotWings<=6)
{
discount=0.0;
cout<<"\nDiscount Rate "<<(discountRate *100)<<"%";
subTotal=hotWings * wingPrice;
cout<<"\nSubtotal: "<<subTotal;
cout<<"\nDiscount:"<<subTotal * discountRate;
cout<<"\nTotal: "<<(subTotal-(subTotal * discountRate));
}
else if(hotWings >6 && hotWings <=12)
{
discountRate=0.10;
cout<<"\nDiscount Rate "<<(discountRate *100)<<"%";
subTotal=hotWings * wingPrice;
cout<<"\nSubtotal: "<<subTotal;
cout<<"\nDiscount:"<<subTotal * discountRate;
cout<<"\nTotal: "<<(subTotal-(subTotal * discountRate));
}
else if(hotWings >12 && hotWings <24)
{
discountRate= 0.20;
cout<<"\nDiscount Rate "<<(discountRate *100)<<"%";
subTotal=hotWings * wingPrice;
cout<<"\nSubtotal: "<<subTotal;
cout<<"\nDiscount:"<<subTotal * discountRate;
cout<<"\nTotal: "<<(subTotal-(subTotal * discountRate));
}
else if(sourWings <= 6){
discountRate=0.05;
cout<<"\nDiscount Rate "<<(discountRate *100)<<"%";
subTotal=sourWings * wingPrice;
cout<<"\nSubtotal: "<<subTotal;
cout<<"\nDiscount:"<<subTotal * discountRate;
cout<<"\nTotal: "<<(subTotal-(subTotal * discountRate));
}
else if(sourWings >6 && sourWings <=12)
{
discountRate=0.10;
cout<<"\nDiscount Rate "<<(discountRate *100)<<"%";
subTotal=sourWings * wingPrice;
cout<<"\nSubtotal: "<<subTotal;
cout<<"\nDiscount:"<<subTotal * discountRate;
cout<<"\nTotal: "<<(subTotal-(subTotal * discountRate));
}
else if(sourWings >12 && sourWings <24)
{
discountRate= 0.15;
cout<<"\nDiscount Rate "<<(discountRate *100)<<"%";
subTotal=sourWings * wingPrice;
cout<<"\nSubtotal: "<<subTotal;
cout<<"\nDiscount:"<<subTotal * discountRate;
cout<<"\nTotal: "<<(subTotal-(subTotal * discountRate));
}
else if(sweetWings<=6)
{
discountRate=0.05;
cout<<"in sweet wing";
cout<<"\nDiscount Rate "<<(discountRate *100)<<"%";
subTotal=sweetWings * wingPrice;
cout<<"\nSubtotal: "<<subTotal;
cout<<"\nDiscount:"<<subTotal * discountRate;
cout<<"\nTotal: "<<(subTotal-(subTotal * discountRate));
}
if(sweetWings >6 && sweetWings <=12)
{
discountRate=0.10;
cout<<"\nDiscount Rate "<<(discountRate *100)<<"%";
subTotal=sweetWings * wingPrice;
cout<<"\nSubtotal: "<<subTotal;
cout<<"\nDiscount:"<<subTotal * discountRate;
cout<<"\nTotal: "<<(subTotal-(subTotal * discountRate));
}
else if(sweetWings >12 && sweetWings <24)
{
discountRate= 0.15;
cout<<"\nDiscount Rate "<<(discountRate *100)<<"%";
subTotal=sweetWings * wingPrice;
cout<<"\nSubtotal: "<<subTotal;
cout<<"\nDiscount:"<<subTotal * discountRate;
cout<<"\nTotal: "<<(subTotal-(subTotal * discountRate));
}
else
{
//nothing
}
cout<<"\nEnter yes to add another order of wings ";
cin>>input;
if(input=="yes"||"Yes")
{
cout<<"\nEnter the type of Wing 1-for-Hot wings, 2-for-sweet wing and 3-for-sour wing and 4-to quit the purchasing";
cin>>wingType;}
else
{
break;
}
}
return 0;
}