//Beginning definitons page #include #include "MechanicBill.h" using namespace std; MechanicBill::MechanicBill() { } MechanicBill::MechanicBill ( int a1, int a2, double a3)//for customer 2 { brake_pads = a1; tires = a2; quarts_oil = a3; } void MechanicBill::set_brake_pads ( int ) { do { cout << "How many brake pads do you wish to change? ( 0 - 4 Whole numbers only!)" <> brake_pads; if ( brake_pads >= 0 && brake_pads <= 4 ) { } else{ cout << "ERROR. Please enter a number from 0 - 4." < 4); } void MechanicBill::set_tires ( int ) { do { cout << "How many tires would you like to replace today? ( 0 - 4 Whole numbers only!)" << endl; cin >> tires; if ( tires >= 0 && tires <= 4 ) { } else{ cout << "ERROR. Please enter a number from 0 - 4." < 4); } void MechanicBill::set_oil ( double ) { do { cout << "How many quarts of oil does your car need? ( 0 - 7.5)" << endl; cin >> quarts_oil; if ( quarts_oil >= 0 && quarts_oil <= 7.5 ) { } else{ cout << "ERROR. Please enter a number from 0 - 7.5." < 7.5); } void MechanicBill::calc_total() { cout.setf(ios::fixed); cout.setf(ios::showpoint); cout.precision(2); cout << "Brake pads ordered " << brake_pads << endl; cout << "Tires ordered " << tires << endl; cout << "Quarts of oil needed " << quarts_oil << endl; parts_cost = (brake_pads * 25) + (tires * 50) + (quarts_oil * 5.50); cout << "Parts cost = " << parts_cost << endl; labor_cost = (brake_pads * 10) + (tires * 15) + (quarts_oil * .50); cout << "Labor cost = " << labor_cost << endl; tax_cost = ( parts_cost * .05) + (labor_cost * .1); cout << "Tax total = " << tax_cost << endl; total_cost = parts_cost + labor_cost + tax_cost; cout << "Total cost $" << total_cost << endl; cout << endl; } void MechanicBill::calc_parts_cost() { parts_cost = (brake_pads * 25) + (tires * 50) + (quarts_oil * 5.50); } void MechanicBill::calc_labor_cost() { labor_cost = (brake_pads * 10) + (tires * 15) + (quarts_oil * .50); } void MechanicBill::calc_tax_cost() { tax_cost = ( parts_cost * .05) + (labor_cost * .1); } MechanicBill operator+(const MechanicBill& bill1, const MechanicBill& bill2) { MechanicBill temp;//These adds all the parts and labor for the combined fucntion customer3. temp.brake_pads = bill1.brake_pads + bill2.brake_pads; temp.tires= bill1.tires + bill2.tires; temp.quarts_oil = bill1.quarts_oil + bill2.quarts_oil; temp.labor_cost = bill1.labor_cost + bill2.labor_cost; temp.parts_cost = bill1.parts_cost + bill2.parts_cost; temp.tax_cost = bill1.tax_cost + bill2.tax_cost; temp.total_cost = bill1.total_cost + bill2.total_cost; return temp; } bool operator ==(const MechanicBill& bill1, const MechanicBill& bill2) { return( bill1.total_cost == bill2.total_cost ); } ostream& operator <<(std::ostream& outs, const MechanicBill& bill) { //These are the calls for customer3 outs << "Brakes = " << bill.brake_pads << endl; outs << "Tires = " << bill.tires << endl; outs << "Quarts of oil = " << bill.quarts_oil << endl; outs << "Parts Cost $" << bill.parts_cost << endl; outs << "Labor cost $" << bill.labor_cost << endl; outs << "Tax Cost $" << bill.tax_cost << endl; outs << "Total cost $" << bill.total_cost << endl; return outs; }