fork download
  1. #include <iostream>
  2. #include <map>
  3.  
  4. using namespace std;
  5.  
  6. int main ()
  7.  
  8. {
  9. std::map<int, const char*> months = { {1, "January"}, {2, "Febuary"} , {3, "March"},
  10. {4, "April"}, {5, "May"}, {6, "June"}, {7, "July"},
  11. {8, "August"}, {9, "September"}, {10, "October"},
  12. {11, "November"}, {12, "December"} };
  13.  
  14. float hourly_rate = 0, tax_rate = 0, gross_salary = 0, net_salary = 0, total_tax = 0;
  15.  
  16. int month = 0;
  17. cout << "Choose a month (1-12)" << endl;
  18. cin >> month;
  19.  
  20. cout << months[month] << endl;
  21.  
  22. cout << "Enter hourly rate:" << endl;
  23. cin >> hourly_rate;
  24.  
  25. cout << "Enter tax rate (%)" << endl;
  26. cin >> tax_rate;
  27.  
  28. gross_salary = 20*8*hourly_rate;
  29. total_tax = (tax_rate/100)*gross_salary;
  30. net_salary = gross_salary-total_tax;
  31.  
  32. if (month == 1 || month == 4 || month == 7 || month == 10)
  33. {
  34. cout << "The employee worked days in " << months[month]
  35. << "\nHourly rate:" << hourly_rate
  36. << "\nGross Salary:" << gross_salary
  37. << "\nIncome Tax Rate:" << tax_rate
  38. << "\nIncome Tax:" << total_tax
  39. << "\nNet Salary:" << net_salary
  40. << endl;
  41. }
  42.  
  43. return(0);
  44. }
Success #stdin #stdout 0s 3236KB
stdin
10
12
5
stdout
Choose a month (1-12)
October
Enter hourly rate:
Enter tax rate (%)
The employee worked days in October
Hourly rate:12
Gross Salary:1920
Income Tax Rate:5
Income Tax:96
Net Salary:1824