0% found this document useful (0 votes)
15 views3 pages

Salary C# Program

The document contains a C# program defining an Employee class that manages employee details including their number, name, and salary calculations. It includes methods for accepting employee details, calculating gross and net salaries based on a basic salary, and displaying the employee's information. The program's main function creates an Employee object and executes these methods in sequence.

Uploaded by

tinozzzacky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Salary C# Program

The document contains a C# program defining an Employee class that manages employee details including their number, name, and salary calculations. It includes methods for accepting employee details, calculating gross and net salaries based on a basic salary, and displaying the employee's information. The program's main function creates an Employee object and executes these methods in sequence.

Uploaded by

tinozzzacky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

using System;

class Employee

public string EmpNumber, Name;

public double BasicSalary, GrossSalary, NetSalary;

public void AcceptDetails()

Console.Write("Enter Employee Number: ");

EmpNumber = Console.ReadLine();

Console.Write("Enter Employee Name: ");

Name = Console.ReadLine();

Console.Write("Enter Basic Salary: ");

BasicSalary = Convert.ToDouble(Console.ReadLine());

public void CalculateSalary()

double allowances = BasicSalary * 0.52;

GrossSalary = BasicSalary + allowances;

double tax = GrossSalary * 0.08;

NetSalary = GrossSalary - tax;


}

public void DisplayDetails()

Console.WriteLine("\nEmployee Details:");

Console.WriteLine("Number: " + EmpNumber);

Console.WriteLine("Name: " + Name);

Console.WriteLine("Basic Salary: " + BasicSalary);

Console.WriteLine("Gross Salary: " + GrossSalary);

Console.WriteLine("Net Salary: " + NetSalary);

class Program

static void Main()

Employee emp = new Employee();

emp.AcceptDetails();

emp.CalculateSalary();

emp.DisplayDetails();

}
Output

You might also like