//libraries #include using namespace std; #include using std::setw; //Set a width between columns using std::setiosflags; using std::setprecision; //Fixed point decimal //function prototype float calculateCharges(float hours); int main() { //hours for each customer float hours1, hours2, hours3; //charges for each customer float charge1, charge2, charge3; cout << "Enter hours parked for each of three customers."; cout << "If customer parked for a fractional amount of hours, round up!" << setiosflags ( ios::fixed | ios::showpoint ); cin >> hours1 >> hours2 >> hours3; //stores each person's charges charge1 = calculateCharges(hours1); charge2 = calculateCharges(hours2); charge3 = calculateCharges(hours3); //spreadsheet-like display of hours and total charges cout << " Car" << setw ( 10 ) << "Hours" << setw ( 10 ) << "Charge" < 3 && hours <= 19) //Add $.50 per hour up to $10.00 { return 2 + (.5 * (hours - 3)); } if (hours > 19) //Maximum $10.00 { return 10; } return 0; }