#include // A company pays its sales representatives according // to the following commission structure: // // - No commission is paid on the first $20,000 // in sales. // // - A commission of 8% is paid on all sales // above $20,000. // // - If the representative has at least $1,000,000 // in sales, an additional $50,000 bonus is paid. // // - If the representative has at least $1,500,000 // in sales, the total bonus is instead $100,000. // // Write a program that asks the user for the amount // sold by a sales representative and then prints the // total commission, including any bonus. // // You may assume that the amount entered is an integer // number of dollars. // // If the user enters a negative amount, immediately // terminate the program by returning 0 from main(). // Function declarations int main(); // Function definitions int main() { return 0; } // Here is one solution: /* int main() { int sales{}; std::cout << "Enter the amount sold by the representative: "; std::cin >> sales; if ( sales < 0 ) { return 0; } int commission{ 0 }; // No commission is paid on the first $20,000. // Any sales above $20,000 earn an 8% commission. if ( sales > 20000 ) { commission += ((sales - 20000)*8)/100; } // At $1,000,000 in sales, add a $50,000 bonus. if ( sales >= 1000000 ) { commission += 50000; } // At $1,500,000 in sales, add another $50,000, // making the total bonus $100,000. if ( sales >= 1500000 ) { commission += 50000; } std::cout << "The commission, including bonuses, is $" << commission << std::endl; return 0; } */