// This program is to calculate the different sizes of box needed // gor the tot
ID: 3567073 • Letter: #
Question
// This program is to calculate the different sizes of box needed
// gor the total number of doglings
#include <iostream>
#include <string>
using namespace std;
int main ()
{
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
string fname, address, city, state, zipcode ;
int huge, large, medium, small;
int temp;
int doflings;
double total;
double cost,tax;
// This is to enter the name of purchaser
cout << "Enter name of the purchaser: ";
getline( cin, fname);
// This is to enter the street address
cout << "Enter the street address: ";
getline( cin,address);
// This is to enter the city
cout << "Enter city: ";
getline( cin,city);
// This is to enter the state
cout << "Enter state (Use abbriviation XX): ";
cin >> state;
// This is to enter the zipcode
cout << "Enter zipcode: ";
cin >> zipcode;
cout << endl;
// This is to enter the number of doflings
cout << "Enter the number of doflings : ";
cin >> doflings;
cout << endl << endl;
// This is to print the ship to
cout << " Ship to : " << fname << endl << endl
<<" " << address << endl
<<" " << city << "," << state << " " << zipcode << endl<< endl;
cout << "Number of doflings : " << doflings << endl<< endl;
// This is to get number of huge needed
huge = (doflings/50);
temp = (doflings%50);
// This is to get number of large needed
large = (temp/20);
temp = (temp%20);
// This is to ger number of medium needed
medium = (temp/5);
temp = (temp%5);
small = (temp/1);
// This outputs the number of different sizes needed
cout << "Container Size Number Required ";
cout << "--------------- ---------------- ";
cout << "Huge : "<< huge << endl;
cout << "Large : "<< large << endl;
cout << "Medium : "<< medium << endl;
cout << "Small : "<< small << endl << endl;
cout << "-----------------------------------"<< endl;
// This is to calculate the cost of doflingies if they are less than 100
if (doflings < 100)
{
cost = (19.95* doflings); // calc cost of doflingies
cout << "Doflingy total cost : $" << cost << endl;
total = (huge*4)+(large*2)+(medium*0.75)+(small*0.20); // calc cost of shipping
cout <<"Shiping total cost : $"<< total << endl;
tax = (cost+total)*0.0775; // calc sales tax
cout <<"Sales tax : $" << tax << endl << endl;
cout << "-----------------------------------"<< endl;
cout << "Total : $" << cost+total+tax << endl; // calc total cost
}
// This is to calculate the cost of doflingies between 100 and 249
else if (doflings <= 249)
{
cost = (18.95* doflings); // calc cost of doflingies
cout << "Doflingy total cost : $" << cost << endl;
total = (huge*4)+(large*2)+(medium*0.75)+(small*0.20); // calc cost of shipping
cout <<"Shiping total cost : $"<< total << endl;
tax = (cost+total)*0.0775; // calc sales tax
cout <<"Sales tax : $" << tax << endl << endl;
cout << "-----------------------------------"<< endl;
cout << "Total : $" << cost+total+tax << endl; // calc total cost
}
// This is to calculate the cost of doflingies between 250 and 499
else if (doflings <= 499)
{
cost = (17.50* doflings); // calc cost of doflingies
cout << "Doflingy total cost : $" << cost << endl;
total = (huge*4)+(large*2)+(medium*0.75)+(small*0.20); // calc cost of shipping
cout <<"Shiping total cost : $"<< total << endl;
tax = (cost+total)*0.0775; // calc sales tax
cout <<"Sales tax : $" << tax << endl << endl;
cout << "-----------------------------------"<< endl;
cout << "Total : $" << cost+total+tax << endl; // calc total cost
}
// This is to calculate the cost of doflingies above 500
else if (doflings >= 500)
{
cost = (15.95* doflings); // calc cost of doflingies
cout << "Doflingy total cost : $" << cost << endl;
total = (huge*4)+(large*2)+(medium*0.75)+(small*0.20); // calc cost of shipping
cout <<"Shiping total cost : $"<< total << endl;
tax = (cost+total)*0.0775; // calc sales tax
cout <<"Sales tax : $" << tax << endl << endl;
cout << "-----------------------------------"<< endl;
cout << "Total : $" << cost+total+tax << endl; // calc total cost
}
return 0 ;
}
Explanation / Answer
100% Fresh answer, guaranteed to get you best grades possible. Just check it out: http://programmingtutor3.tk/
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.