I wish to make a program that gives computations for a water bill for various respective companies.

The programs runs fine, I just want to format it to where my outputs are right justified to make it look nicer.

code:

Code:

#include <iostream>#include <iomanip>
#include <string>
using namespace std;
int main()
{
char name [256];
char type;
double gallons;
double base;
double fee;
cout << "Please Name/Title: " << endl;
cin.getline(name, 256);
cout << "Please insert customer type: \n (R= Resident) \n (B= Business) \n (G= Govt.) \n (N= NonProfit): " << endl;
cin >> type;
cout << "Please enter number of gallons used: " << endl;
cin >> gallons;
cout << fixed << right << setprecision(2) << showpoint;
cin.setf(ios::right);
cout << name << endl;
cout << "Gallons Used: " << setw(10) << setfill('.') << " " << right << gallons << endl;
switch (type)
{
case 'R':
base = 15.00;
if (gallons > 1000)
{
fee = (gallons - 1000) * .02;
}
break;
case 'B':
base = 25.00;
if (gallons > 2000)
{
fee = (gallons - 2000) * .03;
}
break;
case 'G':
base = 5.00;
if (gallons > 500)
{
fee = (gallons - 500 ) * .01;
}
break;
case 'N':
base = 5.00;
if (gallons > 500)
{
fee = (gallons - 500 ) * .01;
}
break;
case 'r':
base = 15.00;
if (gallons > 1000)
{
fee = (gallons - 1000) * .02;
}
break;
case 'b':
base = 25.00;
if (gallons > 2000)
{
fee = (gallons - 2000) * .03;
}
break;
case 'g':
base = 5.00;
if (gallons > 500)
{
fee = (gallons - 500 ) * .01;
}
break;
case 'n':
base = 5.00;
if (gallons > 500)
{
fee = (gallons - 500 ) * .01;
}
break;
}
cout << "Water base fee: " << setfill('.') << setw(8) << "$ " << right << base << endl;
cout << "Water usage fee: " << setfill('.') << setw(7) << "$ " << right << fee <<endl;
cout << "Sewage base fee: " << setfill('.') << setw(7) << "$ " << right << base << endl;
cout << "Sewage usage fee: " << setfill('.') << setw(6) << "$ " << right << fee * .8 << endl;
cout << "Total due: " << setfill('.') << setw(13) << "$ " << right << (base * 2) + fee + (fee * .8) << endl;
cin.get();
cin.get();
return 0;
}

i would like the output to show as so:

Gallons used ................ 100000

Water base fee ..............$ 5.00

Water usage fee .........$ 995.00

Sewage base fee ............$ 5.00

Sewage usage fee .......$ 796.00

Total due .................$ 1801.00

(aligned, of course)

any help would be appreciated

-Apo-S