0% found this document useful (0 votes)
38 views

Switch (Scale) (Case 1

The document contains code for a salary calculator program that uses a switch statement to calculate salary details like increment amount, increased salary, tax deduction, and net salary for different pay scales (SPS6, SPS7, SPS8, SPS9) based on initial salary, increment rate, and tax deduction rate values. The user is prompted to select a pay scale and the calculations are performed and output for that selected scale.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Switch (Scale) (Case 1

The document contains code for a salary calculator program that uses a switch statement to calculate salary details like increment amount, increased salary, tax deduction, and net salary for different pay scales (SPS6, SPS7, SPS8, SPS9) based on initial salary, increment rate, and tax deduction rate values. The user is prompted to select a pay scale and the calculations are performed and output for that selected scale.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

#include<iostream>

using namespace std;


 
void main(){
            int scale, initialSalary, incrementRate, taxDeductionRate;
            float incrementValue, taxValue, netSalary = 0;
           
            cout<<“*********** SALARY CALCULATOR **************\n”;
            cout<<“*******************************************\n”;
            cout<<“*********** ENTER 1 FOR SPS6  *************\n”;
cout<<“*********** ENTER 2 FOR SPS7  *************\n”;
            cout<<“*********** ENTER 3 FOR SPS8  *************\n”;
            cout<<“*********** ENTER 4 FOR SPS9  *************\n”;
           
            cout<<“Select a pay scale from the menu: “;

cin>>scale;
switch (scale)

case 1:
                   initialSalary = 40000;
                        incrementRate = 20;
                        taxDeductionRate = 3;

incrementValue = ((initialSalary * incrementRate) / 100);


            taxValue = (((initialSalary + incrementValue) * taxDeductionRate) / 100);
            netSalary = (initialSalary + incrementValue) – taxValue;
            cout<<“Initial Salary : “<<initialSalary;
            cout<<“\nIncrement Amount : “<<incrementValue;
            cout<<“\nIncreased Salary : “<<initialSalary + incrementValue;
            cout<<“\nTex Deduction : “<<taxValue;
            cout<<“\nNet Salary : “<<netSalary;

break;

case 2:
initialSalary = 60000;
                        incrementRate = 15;
                        taxDeductionRate = 3;

            incrementValue = ((initialSalary * incrementRate) / 100);


            taxValue = (((initialSalary + incrementValue) * taxDeductionRate) / 100);
            netSalary = (initialSalary + incrementValue) – taxValue;
            cout<<“Initial Salary : “<<initialSalary;
            cout<<“\nIncrement Amount : “<<incrementValue;
            cout<<“\nIncreased Salary : “<<initialSalary + incrementValue;
            cout<<“\nTex Deduction : “<<taxValue;
            cout<<“\nNet Salary : “<<netSalary;
break;
case 3:
                        initialSalary = 80000;
                        incrementRate = 10;
                        taxDeductionRate = 3;

            incrementValue = ((initialSalary * incrementRate) / 100);


            taxValue = (((initialSalary + incrementValue) * taxDeductionRate) / 100);
            netSalary = (initialSalary + incrementValue) – taxValue;
            cout<<“Initial Salary : “<<initialSalary;
            cout<<“\nIncrement Amount : “<<incrementValue;
            cout<<“\nIncreased Salary : “<<initialSalary + incrementValue;
            cout<<“\nTex Deduction : “<<taxValue;
            cout<<“\nNet Salary : “<<netSalary;
break;

case 4:
                        initialSalary = 100000;
                        incrementRate = 5;
                        taxDeductionRate = 3;

            incrementValue = ((initialSalary * incrementRate) / 100);


            taxValue = (((initialSalary + incrementValue) * taxDeductionRate) / 100);
            netSalary = (initialSalary + incrementValue) – taxValue;
            cout<<“Initial Salary : “<<initialSalary;
            cout<<“\nIncrement Amount : “<<incrementValue;
            cout<<“\nIncreased Salary : “<<initialSalary + incrementValue;
            cout<<“\nTex Deduction : “<<taxValue;
            cout<<“\nNet Salary : “<<netSalary;
break;

default:
cout<<“You enter wrong scale\n”;
}

You might also like