CS Knowledge Opener - Logo
CS Knowledge
Opener
Facebook Youtube Telegram
  • Home
  • 12th CS
    • 12th CS English Medium
    • 12th CS Tamil Medium
  • 12th CA
    • 12th CA English Medium
    • 12th CA Tamil Medium
  • 11th CS
    • 11th CS English Medium
    • 11th CS Tamil Medium
  • 11th CA
    • 11th CA English Medium
    • 11th CA Tamil Medium
  • CS / CA Question Bank
  • Other Subjects
  • Student Alerts
  • Govt Exams
  • Home
  • 12th CS
    • 12th CS English Medium
    • 12th CS Tamil Medium
  • 12th CA
    • 12th CA English Medium
    • 12th CA Tamil Medium
  • 11th CS
    • 11th CS English Medium
    • 11th CS Tamil Medium
  • 11th CA
    • 11th CA English Medium
    • 11th CA Tamil Medium
  • CS / CA Question Bank
  • Other Subjects
  • Student Alerts
  • Govt Exams
CS Knowledge Opener - Logo
CS Knowledge
Opener
Facebook Youtube Telegram
  • Home
  • 12th CS
    • 12th CS English Medium
    • 12th CS Tamil Medium
  • 12th CA
    • 12th CA English Medium
    • 12th CA Tamil Medium
  • 11th CS
    • 11th CS English Medium
    • 11th CS Tamil Medium
  • 11th CA
    • 11th CA English Medium
    • 11th CA Tamil Medium
  • CS / CA Question Bank
  • Other Subjects
  • Student Alerts
  • Govt Exams
  • Home
  • 12th CS
    • 12th CS English Medium
    • 12th CS Tamil Medium
  • 12th CA
    • 12th CA English Medium
    • 12th CA Tamil Medium
  • 11th CS
    • 11th CS English Medium
    • 11th CS Tamil Medium
  • 11th CA
    • 11th CA English Medium
    • 11th CA Tamil Medium
  • CS / CA Question Bank
  • Other Subjects
  • Student Alerts
  • Govt Exams
11th CS English Medium

Practical Program Exercise 1 Gross Salary for 11th Computer Science

Baskaran J
February 1, 2023 2 Mins Read
4.5K Views
0 Comments

setw ( )

  • setw manipulator sets the width of the field assigned for the output.
  • The field width determines the minimum number of characters to be written in output.
  • In the below program, every output statement has two setw( ) manipulators; first setw (25) creates a filed with 25 spaces and second setw(10) creates another field with 10 spaces.
  • When you represent a value to these fields

CS1 – GROSS SALARY

QUESTION:

Write a C++ program to input basic salary of an employee and calculate its Gross salary according to following:

Basic Salary <25000 : HRA = 20%, DA = 80%

Basic Salary >= 25000 : HRA = 25%, DA = 90%

Basic Salary >= 40000 : HRA = 30%, DA = 95%

AIM:

To write a C++ program to input basic salary of an employee and calculate its Gross salary.

CODING:

#include<iostream>

#include<iomanip>

using namespace std;

int main()

{

float basic, gross, da, hra;

cout<<“Enter the Basic Pay of an Employee:”;

cin>>basic;

if(basic<25000)

{

da=basic*80/100;

hra=basic*20/100;

}

else if(basic>=25000 && basic<40000)

{

da=basic*90/100;

hra=basic*25/100;

}

else if(basic>=40000)

{

da=basic*95/100;

hra=basic*30/100;

}

gross=basic+hra+da;

cout<<setw(25)<<“Basic Pay:”<<setw(10)<<basic<<endl;

cout<<setw(25)<<“Dearness Allowance:”<<setw(10)<<da<<endl;

cout<<setw(25)<<“House Rent Allowance:”<<setw(10)<<hra<<endl;

cout<<setw(25)<<“”<<setw(10)<<“———-“<<endl;

cout<<setw(25)<<“Gross Salary”<<setw(10)<<gross<<endl;

cout<<setw(25)<<“”<<setw(10)<<“———-“<<endl;

return 0;

}

OUTPUT:

Enter the Basic Pay of an Employee:25000

Basic Pay:                              25000

Dearness Allowance:             22500

House Rent Allowance:           6250

———-

Gross Salary:                        53750

———-

RESULT:

The Output was verified successfully

Tags:

Practical

Share Article

Follow Me Written By

Baskaran J

Other Articles

Previous

Practical Program Exercise 1 Calculate Factorial and Sum of Series for 12th Computer Science

Next

Practical Program Exercise 2 Percentage for 11th Computer Science

Next
February 1, 2023

Practical Program Exercise 2 Percentage for 11th Computer Science

Previous
February 1, 2023

Practical Program Exercise 1 Calculate Factorial and Sum of Series for 12th Computer Science

No Comment! Be the first one.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

five × five =

Related Posts

11th CS Board Exam Answer Key Discussion 2024-2025

Baskaran J
March 14, 2025

11th Computer Science Practice One marks question 2024-2025

Baskaran J
February 3, 2025

11th Computer Science English medium Public Exam Important Important Question 2024-2025

Baskaran J
January 17, 2025

11th computer science English medium new study material 2024-2025

Baskaran J
November 1, 2024

Subscribe to our newsletter and stay updated.

CS Knowledge Opener

CS Knowledge Opener focuses on 11th &12th Computer Science & Computer Applications English Medium & Tamil Medium. Programming Skills and also we are Publishing Study Materials Based on New syllabus introduced by TNSCERT. (TNBOARD).

Quick Links

  • Contact Us
  • About Us
  • Privacy Policy
  • Disclaimer
  • Terms and Conditions
Categories
11th CA English Medium 15
11th CA Tamil Medium 9
11th CS English Medium 21
11th CS Tamil Medium 12
12th CA English Medium 32
12th CA Tamil Medium 8
12th CS English Medium 36
12th CS Tamil Medium 12
Government Exams 36
Notifications 8
Other Subjects 13

Follow Us

Youtube
Facebook
Telegram
CS Knowledge Opener © 2020 - 2025. All Rights Reserved.