fork download
  1. /* ************************
  2. *Name: Manuel Vega
  3. *Professor: Dennis Rainey
  4. *Date: 01/25/2026 *
  5. *Title: Hw_1a
  6. *_________________________*
  7. *Input:
  8. *
  9. */
  10.  
  11. #include <iostream>
  12. #include <string>
  13. using namespace std;
  14. float getSalesAmt(float valueReturned);
  15. float calcCommission(float value, float valueReturned);
  16. float calcPay(int basepay, float commission, float totalPay);
  17. void displayPay();
  18. int main() {
  19. displayPay();
  20. return 0;
  21. }
  22.  
  23. float getSalesAmt(float valueReturned)
  24. {
  25. cin>>valueReturned;
  26. cout<<"Enter monthly sales amount: "<<valueReturned<<endl;
  27. cout<<"Monthly Sales: $ "<<valueReturned<<endl;
  28. return valueReturned;
  29. }
  30. float calcCommission(float value, float valueReturned)
  31. {
  32. // cout<<value<<endl;
  33. if(value >= 25000 & value <50000)
  34. {
  35. value= value * 0.015;
  36. }else if(value>=50000)
  37. {
  38. value = value * 0.02;
  39. }else
  40. {
  41. value = 0;
  42. }
  43. valueReturned = value;
  44. cout<<"Commission: $ "<<valueReturned<<endl;
  45. return valueReturned;
  46. }
  47. float calcPay(int basepay, float commission, float totalPay)
  48. {
  49. totalPay = basepay + commission;
  50. cout<<"Total Pay: $ "<<totalPay<<endl;
  51. return totalPay;
  52. }
  53. void displayPay()
  54. {
  55. const int basepay = 2500;
  56. float monthlyRevenue;
  57. float commission;
  58. float totalPay;
  59. string check;
  60. do{
  61. monthlyRevenue = getSalesAmt(monthlyRevenue);
  62. commission = calcCommission(monthlyRevenue, commission);
  63. totalPay = calcPay(basepay, commission, totalPay);
  64. cin>>check;
  65. cout<<"Do it again? (Y/N) "<<check<<endl;
  66. }while(check=="Y"||check=="y");
  67. }
Success #stdin #stdout 0.01s 5324KB
stdin
60000
N
stdout
Enter monthly sales amount: 60000
Monthly Sales: $ 60000
Commission:    $ 1200
Total Pay:     $ 3700
Do it again? (Y/N) N