44.5k views
3 votes
They used c++ language to solve this problem

Show transcribed data
please enter employee name? Employee salary? For print? (1) welcome (2) your total monthly income is (3) your total monthly Tax is (4) your monthly net income is (5) your total Anuual income is (6) your total Annual Tax is (7) your Aunual net income is Tax=%10

User Arthropode
by
8.5k points

1 Answer

3 votes

Answer:

Here's an example C++ code that will take an employee's name and salary as input, and output the information requested:

```

#include <iostream>

#include <string>

using namespace std;

int main() {

string name;

double salary;

double monthly_income, monthly_tax, monthly_net_income;

double annual_income, annual_tax, annual_net_income;

const double TAX_RATE = 0.10;

// Get employee name and salary

cout << "Please enter employee name: ";

getline(cin, name);

cout << "Employee salary: ";

cin >> salary;

// Calculate monthly income, tax, and net income

monthly_income = salary / 12.0;

monthly_tax = monthly_income * TAX_RATE;

monthly_net_income = monthly_income - monthly_tax;

// Output welcome message

cout << "Welcome, " << name << "!" << endl;

// Output total monthly income

cout << "Your total monthly income is: $" << monthly_income << endl;

// Output total monthly tax

cout << "Your total monthly tax is: $" << monthly_tax << endl;

// Output monthly net income

cout << "Your monthly net income is: $" << monthly_net_income << endl;

// Calculate annual income, tax, and net income

annual_income = salary;

annual_tax = annual_income * TAX_RATE;

annual_net_income = annual_income - annual_tax;

// Output total annual income

cout << "Your total annual income is: $" << annual_income << endl;

// Output total annual tax

cout << "Your total annual tax is: $" << annual_tax << endl;

// Output annual net income

cout << "Your annual net income is: $" << annual_net_income << endl;

return 0;

}

```

When you run this code, it will ask the user to enter the employee's name and salary, and then output the requested information. The tax rate is set as a constant variable, and all calculations are based on that rate.

User Michael Soulier
by
8.1k points

No related questions found