Code:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
const int ELEMENT = 9;
const int PRICE = 3;
const int NAME = 9;
// functions prototypes
void init();
void process(double [ELEMENT][PRICE], string [NAME]);
void stateSearch();
void wrapup();
int main()
{
double partPrice[ELEMENT][PRICE]= {{000.0, 000.0, 000.0},
{325.25, 377.50, 360.00},
{130.50, 160.00, 155.00},
{245.00, 311.50, 299.00},
{350.45, 410.00, 395.00},
{355.50, 412.00, 380.50},
{195.66, 230.25, 210.00},
{440.50, 505.50, 485.50},
{267.00, 311.50, 301.00}};
string partNames[NAME]= {"Bad Entry", "23 T Running Boards",
"31 Pierce Taillight", "29 A Turtle Deck",
"34 Essex Wind Wing", "35 Hudson Visor",
"09 T Brass Light", "31 Pierce Spoke Wheel",
"36 LaSalle HubCaps"};
init();
process(partPrice, partNames);
wrapup();
return 0;
}
void init()
{
cout << "Lab 1 has started for Natascha Pratt" << endl;
}
void process(double partPrice[ELEMENT][PRICE], string partNames[NAME])
{
int j = 0;
const int size = 5;
string custName[size];
string state[size];
for (j=0; j<size; j++)
{
cout << endl;
cout << "Eenter Customer's Name : ";
cin >> custName[j];
stateSearch();
cout << endl;
}
cout << left;
cout << setw(25)<< "Billing Report" << endl;
cout << setw(10)<< "Sugg.";
cout << setw(10)<< "Sales";
cout << setw(10) << "Total" << endl;
cout << setw(15) <<"Name";
cout << setw(10) << "State";
cout << setw(10) << "Cost" ;
cout << setw(10) << "Retail";
cout << setw(10) << "Price";
cout << setw(10) << "Cost";
cout << endl;
for(j=0; j<size; j++)
{
cout << left;
cout << fixed << showpoint<< setprecision(2);
cout << setw(15) << custName[j];
cout << setw(6) << state[j];
cout << setw(10) << partPrice[j][0];
cout << setw(10) << partPrice[j][1];
cout << setw(10) << partPrice[j][2];
cout << endl;
cout << setw(10) << partNames[j];
cout << endl;
}
}
string stateSearch()
{
string state[6]={"IN", "IL", "OH", "MI", "WI", "KY"}
cout << "Enter State: ";
cin >> state[j];
for (int s = 0; s<6; s++)
if(state[j] == state[0]0
{
cout << "Enter Part No: ";
cin >> partNum[j];
}