Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace EmployeeApp {
- partial class Employee {
- private string empName;
- private int empID;
- private float currPay;
- private int empAge;
- private string empSSN;
- public Employee() { }
- public Employee(string name, int id, float pay, string ssn)
- : this (name, 0, id, pay, ssn) { }
- public Employee(string name, int age, int id, float pay, string ssn) {
- Name = name;
- ID = id;
- Age = age;
- Pay = pay;
- empSSN = ssn;
- }
- public void GiveBonus(float amount) {
- currPay += amount;
- }
- public void DisplayStats() {
- Console.WriteLine ($"Name: {empName}");
- Console.WriteLine ($"ID: {empID}");
- Console.WriteLine ($"Age: {empAge}");
- Console.WriteLine ($"Pay: {currPay}");
- Console.WriteLine ($"SSN: {empSSN}");
- }
- public string Name {
- get { return empName; }
- set {
- if (value.Length > 15)
- Console.WriteLine ("Error! Name must be less than 15 characters!");
- else
- empName = value;
- }
- }
- public int Age {
- get { return empAge; }
- set { empAge = value; }
- }
- public int ID {
- get { return empID; }
- set { empID = value; }
- }
- public float Pay {
- get { return currPay; }
- set { currPay = value; }
- }
- public string SocialSecurityNumber {
- get { return empSSN; }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement