10: Write a program that takes salary amount from the user and applies tax to it. If salary is greater than 100000 deduct 10% tax otherwise deduct 5%. Print the net salary, and amount of tax deducted.

  


// Write a program that takes salary amount from the user and applies tax to it.
// If salary is greater than 100000 deduct 10% tax otherwise deduct 5%.
// Print the net salary, and amount of tax deducted.


#include <iostream>
using namespace std;

int main(){

        float gross_salary, five_tax, ten_tax, net_sal_five, net_sal_ten;

        cout << "Enter your monthly gross salary: Rs.";
        cin >> gross_salary;

            if(gross_salary >= 100000){
                ten_tax = gross_salary * 0.1;
                net_sal_ten = gross_salary - ten_tax;
                cout << "Your net salary is: Rs." << net_sal_ten << endl <<
                    "Tax deducted: Rs." << ten_tax << endl;
            }
            else{
                five_tax = gross_salary * 0.05;
                net_sal_five = gross_salary - five_tax;
                cout << "Your net salary is: Rs." << net_sal_five << endl <<
                    "Tax deducted: Rs." << five_tax << endl;
            }

    return 0;
}

Input 1:


Enter your monthly gross salary: Rs.54000

Output 1:


Your net salary is: Rs.51300 Tax deducted: Rs.2700

Input 2:


Enter your monthly gross salary: Rs.123000

Output 2:


Your net salary is: Rs.110700 Tax deducted: Rs.12300


Comments

Popular posts from this blog

153: Write a program to read an amount (integer value) and break the amount into smallest possible number of bank notes. Note: The possible banknotes are 500, 100, 50, 20, 10, 5, 2, and 1

206: Write a program to create a class named "Circle" which has the property "radius". Define functions to calculate the area and circumference of the circle.

221: // In Task 2, we discussed multilevel inheritance with parameterized constructors for Student, UndergraduateStudent, and GraduateStudent classes in a university management system. Can you explain the advantages of using multilevel inheritance with specific details about the functions and data members in these classes? How were the parameterized constructors (e.g., setting student name, age, and ID) used to ensure that each class in the hierarchy correctly initializes its properties, such as creating an UndergraduateStudent named "John," aged 20, with a student ID of 12345