SlideShare a Scribd company logo
Create a C# application
You are to create a class object called “Employee” which included eight private variables:
firstN
lastN
dNum
wage: holds how much the person makes per hour
weekHrsWkd: holds how many total hours the person worked each week.
regHrsAmt: initialize to a fixed amount of 40 using constructor.
regPay
otPay
After going over the regular hours, the employee gets 1.5x the wage for each additional hour
worked.
Methods:
constructor
properties
CalcPay(): Calculate the regular pay and overtime pay.
Create an “EmployeeDemo” class. In the main function, the program should ask the user the
number of employee in the company and create a 2-dimensional dynamic array (number of
employee by 4 weeks). Then, the program should ask user to enter each employee’s information
and the amount of hours they worked weekly.
The program shows a menu with employee name for user to choose which employee to display
the following information:
How much the person totally made
How much of paycheck is regular pay
How much of paycheck is overtime pay
Solution
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace Employee
{
public enum EmployeeType {GROUPA, GROUPB, GROUPC, GROUPD};
public struct EmployeeSalaryInfo
{
public float hourlyWage;
public int monthlyHours;
public float baseSalary;
public int numSales;
public EmployeeSalaryInfo( EmployeeType eme)
{
this.hourlyWage = 0;
this.monthlyHours = 0;
this.baseSalary = 0;
this.numSales = 0;
}
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Welcome to the Employee System");
EmployeeArray empArray = new EmployeeArray();
int continueRunning = 1;
do
Console.WriteLine();
Console.WriteLine("Please Enter Your Choice:");
Console.WriteLine("1=Enter new employee");
Console.WriteLine("2=Update existing employee");
Console.WriteLine("3=Delete employee");
Console.WriteLine("4=Print employee list");
Console.WriteLine("Any other number to Exit");
int userChoice = int.Parse(Console.ReadLine());
Console.WriteLine();
switch (userChoice)
{
case 1:
Employee emp = CreateNewWorker(); //Asking for employee information by
creating a new employee.
if (!(empArray.Contains(emp))) //Checking to see that employee does not
exist
empArray.Add(emp); //If the employee does not exist in the list then
we can add it.
else
Console.WriteLine("Can not add new worker. This worker already exists");
break;
case 2: //If user wishes to edit an employee
EditEmployee(empArray);
break;
case 3:
DeleteEmployee(empArray); //if user wishes to delete an employee from
the list
break;
case 4:
empArray.Print();
break;
default:
continueRunning = 0; //If user has chosen to exit the system.
break;
}
} while (continueRunning == 1); //Checking to see if to continue running
the system
}
static Employee CreateNewWorker() //Method for creating a
new employee.
{
Employee emp; //A new employee consists of
the basic information which is
Console.WriteLine("Enter first name:"); //The first name
string first = Console.ReadLine();
Console.WriteLine("Enter last name:"); //The family name
string last = Console.ReadLine();
Console.WriteLine("Enter birth date in DD/MM/YYYY format"); //and
birthday.
DateTime bDay = DateTime.Parse(Console.ReadLine());
Console.WriteLine("Is worker 1=Secretary, 2=Sales, 3=Manager, 4=Top Manager?");
//Also asking for the type
EmployeeSalaryInfo salInfo = GetSalaryInfo(workerType); //and the salary
information
emp = new Employee(first, last, bDay, workerType, salInfo); //with all the
info can create a new employee
return emp;
}
static void EditEmployee(EmployeeArray employees) //Method for
editing an employee and his info
{
Employee emp = GetEmployeeInfo(); //First getting basic
info about employee to edit.
EmployeeSalaryInfo salInfo = new TGCEmployeeSalaryInfo();
if (employees.Contains(emp)) //Then checking that list
has this employee (if not can not edit)
{
Console.WriteLine("Has worker position changed? 1=Yes, 2=No");
int changeType = int.Parse(Console.ReadLine());
if (changeType == 1) //If employee type has
changed
{ //then ask for new type
Console.WriteLine("Is worker 1=Secretary, 2=Sales, 3=Manager, 4=Top
Manager?");
TGCEmployeeType workerType =
(TGCEmployeeType)int.Parse(Console.ReadLine()) - 1;
salInfo = GetSalaryInfo(workerType); //and then ask for his
salary info
employees.Replace(emp, workerType, salInfo); //and finally
replace the info in the salary list.
}
else //if type ha not changed
{
salInfo = GetSalaryInfo(employees.Find(emp)); //then get only
the salary info (without the need for the type)
employees.Replace(emp, employees.Find(emp), salInfo); //and finally
replace the info in the salary list.
}
}
else
Console.WriteLine("There is no such employee");
}
static Employee GetEmployeeInfo() //A method for getting the basic information
about an employee which includes
{
Console.WriteLine("Enter first name of the employee");
string first = Console.ReadLine(); //His First name
Console.WriteLine("Enter last name of the employee");
string last = Console.ReadLine(); //His last name
Console.WriteLine("Enter birth date in DD/MM/YYYY format");
DateTime bDay = DateTime.Parse(Console.ReadLine()); //And his birthday
Employee emp = new Employee(first, last, bDay);
return emp; //and then we can create an emplyee object (without
adding him to the list)
}
static TGCEmployeeSalaryInfo GetSalaryInfo(TGCEmployeeType empType) //A
method for getting the salary info about a certain employee type from the user
{
TGCEmployeeSalaryInfo salInfo = new TGCEmployeeSalaryInfo(empType);
switch(empType) //A switch to see what the type is so
that the correct questions could be asked
{
case (EmployeeType)0: //if it is a secretary than ask for
hourly wage and number of hours
Console.WriteLine("Please Enter Hourly Wage");
salInfo.hourlyWage = float.Parse(Console.ReadLine());
Console.WriteLine("Please Enter Number of Hours Worked");
salInfo.monthlyHours = int.Parse(Console.ReadLine());
break;
case (TGCEmployeeType)1: //if it is a sales person than ask
for base salary, number of sales and bomus per sale
Console.WriteLine("Please Enter Base Salary");
salInfo.baseSalary = float.Parse(Console.ReadLine());
Console.WriteLine("Please Enter Number of Sales");
salInfo.numSales = int.Parse(Console.ReadLine());
Console.WriteLine("Please Enter Bonus per Sale");
salInfo.salaryBonus = float.Parse(Console.ReadLine());
break;
case (TGCEmployeeType)2: //if it is a manager than ask for
the base salary. The bonus is currently constant as part of the salary info struct
Console.WriteLine("Please Enter Base Salary");
salInfo.baseSalary = float.Parse(Console.ReadLine());
break;
case (EmployeeType)3: //if it is a top manager than ask for
the base salary. The bonus is currently constant as part of the salary info struct
Console.WriteLine("Please Enter Base Salary");
salInfo.baseSalary = float.Parse(Console.ReadLine());
break;
}
return salInfo;
}
}
class Employee //An employee class which includes all the
information about an employee, ways to retrieve and set the info, and calculate its salary
{
string firstName;
string familyName;
DateTime birthDate;
EmployeeType employeeType;
EmployeeSalaryInfo employeeSalaryInfo;
public Employee(string first, string family, DateTime bDay) //first constructor which creates
an employee without his salary info and type.
{
firstName = first;
familyName = family;
birthDate = bDay;
}
public Employee(string first, string family, DateTime bDay, EmployeeType empType,
EmployeeSalaryInfo salInfo) //second constructor which creates an employee with all info
{
firstName = first;
familyName = family;
birthDate = bDay;
employeeType = empType;
employeeSalaryInfo = salInfo;
}
public string FirstName //property method for getting the first name
{
get
{
return this.firstName;
}
}
public string FamilyName //property method for getting the last name
{
get
{
return this.familyName;
}
}
public DateTime BirthDate //property method for getting the birth date
{
get
{
return this.birthDate;
}
}
public EmployeeType EmployeeType //property method for getting the type of employee or
setting it (in case it changed)
{
get
{
return this.employeeType;
}
set
{
this.employeeType = value;
}
}
public EmployeeSalaryInfo SalaryInfo //property method for setting new salary information
for the employee
{
set
{
this.employeeSalaryInfo = value;
}
}
public float CalcSalary() //method for calculating the employee's salary
{
float salary=0;
switch(employeeType)
{
case (EmployeeType)0: //if employee is a secretary than multiply wage per hour by
hours worked
salary = (employeeSalaryInfo.hourlyWage) * (employeeSalaryInfo.monthlyHours);
break;
case ( EmployeeType)1: //if employee is a sales person than multiply number of
sales by bonus per sale and add that to the base salary
salary = ((employeeSalaryInfo.baseSalary) + (employeeSalaryInfo.numSales *
(employeeSalaryInfo.salaryBonus)));
break;
case (EmployeeType)2: //if employee is a manager than add the bonus to the base
salary
salary = (employeeSalaryInfo.baseSalary) + (employeeSalaryInfo.salaryBonus);
break;
case ( EmployeeType)3: //if employee is a top manager than add the bonus to the
base salary
salary = (employeeSalaryInfo.baseSalary) + (employeeSalaryInfo.salaryBonus);
break;
}
return salary;
}
}
public void Print() //a method for printing all employees in the list icluding
name, birthdate, type and salary.
{
Console.WriteLine("Family NametFirst NametBirth DatetWorker TypetSalary");
Console.WriteLine("-----------t----------t----------t-----------t------");
foreach ( Employee e in employees)
Console.WriteLine("{0}t{1}t{2}t{3}t{4}", e.FamilyName.PadRight(11),
e.FirstName.PadRight(10), e.BirthDate.ToShortDateString(),
e.EmployeeType.ToString().PadRight(11), e.CalcSalary());
Console.WriteLine();
}
}
}

More Related Content

Similar to Create a C# applicationYou are to create a class object called “Em.pdf

package employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdfpackage employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdf
anwarsadath111
 
Java Programs
Java ProgramsJava Programs
Java Programs
Seetharamaiah Vadde
 
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdfRepeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
arracollection
 
Having issues with passing my values through different functions aft.pdf
Having issues with passing my values through different functions aft.pdfHaving issues with passing my values through different functions aft.pdf
Having issues with passing my values through different functions aft.pdf
rajkumarm401
 
HELP IN JAVACreate a main method and use these input files to tes.pdf
HELP IN JAVACreate a main method and use these input files to tes.pdfHELP IN JAVACreate a main method and use these input files to tes.pdf
HELP IN JAVACreate a main method and use these input files to tes.pdf
fatoryoutlets
 
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docxINTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
normanibarber20063
 
Integration Project Inspection 3
Integration Project Inspection 3Integration Project Inspection 3
Integration Project Inspection 3Dillon Lee
 
Cis407 a ilab 4 web application development devry university
Cis407 a ilab 4 web application development devry universityCis407 a ilab 4 web application development devry university
Cis407 a ilab 4 web application development devry universitylhkslkdh89009
 
package employeeType.employee;public class Employee {    private.pdf
package employeeType.employee;public class Employee {    private.pdfpackage employeeType.employee;public class Employee {    private.pdf
package employeeType.employee;public class Employee {    private.pdf
sharnapiyush773
 
operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf
operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdfoperating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf
operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf
arasanmobiles
 
Code Include libraries. import javax.swing.JOptionPane;.pdf
Code Include libraries. import javax.swing.JOptionPane;.pdfCode Include libraries. import javax.swing.JOptionPane;.pdf
Code Include libraries. import javax.swing.JOptionPane;.pdf
ankitmobileshop235
 
Cis 407 i lab 4 of 7
Cis 407 i lab 4 of 7Cis 407 i lab 4 of 7
Cis 407 i lab 4 of 7helpido9
 
4.3 Hibernate example.docx
4.3 Hibernate example.docx4.3 Hibernate example.docx
4.3 Hibernate example.docx
yasothamohankumar
 
So Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdfSo Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdf
arihantgiftgallery
 
import java.io.-WPS Office.docx
import java.io.-WPS Office.docximport java.io.-WPS Office.docx
import java.io.-WPS Office.docx
Katecate1
 
Write a C++ program with a function defined to give the person a .pdf
Write a C++ program with a function defined to give the person a .pdfWrite a C++ program with a function defined to give the person a .pdf
Write a C++ program with a function defined to give the person a .pdf
arihantgiftgallery
 
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdfThe solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
aparnatiwari291
 
TypeScriptで書くAngularJS @ GDG神戸2014.8.23
TypeScriptで書くAngularJS @ GDG神戸2014.8.23TypeScriptで書くAngularJS @ GDG神戸2014.8.23
TypeScriptで書くAngularJS @ GDG神戸2014.8.23
Okuno Kentaro
 
This code has nine errors- but I don't know how to solve it- Please g.pdf
This code has nine errors- but I don't know how to solve it-  Please g.pdfThis code has nine errors- but I don't know how to solve it-  Please g.pdf
This code has nine errors- but I don't know how to solve it- Please g.pdf
aamousnowov
 

Similar to Create a C# applicationYou are to create a class object called “Em.pdf (20)

package employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdfpackage employeeType.employee;public class Employee {   private .pdf
package employeeType.employee;public class Employee {   private .pdf
 
slides
slidesslides
slides
 
Java Programs
Java ProgramsJava Programs
Java Programs
 
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdfRepeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
Repeat Programming Project 2 in Chapter 5. This time, add the follow.pdf
 
Having issues with passing my values through different functions aft.pdf
Having issues with passing my values through different functions aft.pdfHaving issues with passing my values through different functions aft.pdf
Having issues with passing my values through different functions aft.pdf
 
HELP IN JAVACreate a main method and use these input files to tes.pdf
HELP IN JAVACreate a main method and use these input files to tes.pdfHELP IN JAVACreate a main method and use these input files to tes.pdf
HELP IN JAVACreate a main method and use these input files to tes.pdf
 
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docxINTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
INTERMIDIATE PROGRAMMINGCMPSC 122LAB 9 INHERITANCE AND POLYMO.docx
 
Integration Project Inspection 3
Integration Project Inspection 3Integration Project Inspection 3
Integration Project Inspection 3
 
Cis407 a ilab 4 web application development devry university
Cis407 a ilab 4 web application development devry universityCis407 a ilab 4 web application development devry university
Cis407 a ilab 4 web application development devry university
 
package employeeType.employee;public class Employee {    private.pdf
package employeeType.employee;public class Employee {    private.pdfpackage employeeType.employee;public class Employee {    private.pdf
package employeeType.employee;public class Employee {    private.pdf
 
operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf
operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdfoperating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf
operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf
 
Code Include libraries. import javax.swing.JOptionPane;.pdf
Code Include libraries. import javax.swing.JOptionPane;.pdfCode Include libraries. import javax.swing.JOptionPane;.pdf
Code Include libraries. import javax.swing.JOptionPane;.pdf
 
Cis 407 i lab 4 of 7
Cis 407 i lab 4 of 7Cis 407 i lab 4 of 7
Cis 407 i lab 4 of 7
 
4.3 Hibernate example.docx
4.3 Hibernate example.docx4.3 Hibernate example.docx
4.3 Hibernate example.docx
 
So Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdfSo Far I have these two classes but I need help with my persontest c.pdf
So Far I have these two classes but I need help with my persontest c.pdf
 
import java.io.-WPS Office.docx
import java.io.-WPS Office.docximport java.io.-WPS Office.docx
import java.io.-WPS Office.docx
 
Write a C++ program with a function defined to give the person a .pdf
Write a C++ program with a function defined to give the person a .pdfWrite a C++ program with a function defined to give the person a .pdf
Write a C++ program with a function defined to give the person a .pdf
 
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdfThe solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
The solution is as belowEmployeeDemo.javaimport java.util.Scann.pdf
 
TypeScriptで書くAngularJS @ GDG神戸2014.8.23
TypeScriptで書くAngularJS @ GDG神戸2014.8.23TypeScriptで書くAngularJS @ GDG神戸2014.8.23
TypeScriptで書くAngularJS @ GDG神戸2014.8.23
 
This code has nine errors- but I don't know how to solve it- Please g.pdf
This code has nine errors- but I don't know how to solve it-  Please g.pdfThis code has nine errors- but I don't know how to solve it-  Please g.pdf
This code has nine errors- but I don't know how to solve it- Please g.pdf
 

More from feelingspaldi

You have just been hired as an information security engineer for a l.pdf
You have just been hired as an information security engineer for a l.pdfYou have just been hired as an information security engineer for a l.pdf
You have just been hired as an information security engineer for a l.pdf
feelingspaldi
 
Write an essay consists of 5 paragraphs (comparing between a city and.pdf
Write an essay consists of 5 paragraphs (comparing between a city and.pdfWrite an essay consists of 5 paragraphs (comparing between a city and.pdf
Write an essay consists of 5 paragraphs (comparing between a city and.pdf
feelingspaldi
 
Why is Antitrust activity so harmful to consumers and the economy W.pdf
Why is Antitrust activity so harmful to consumers and the economy W.pdfWhy is Antitrust activity so harmful to consumers and the economy W.pdf
Why is Antitrust activity so harmful to consumers and the economy W.pdf
feelingspaldi
 
Why should Emperor Conrad lead the crusades Use bible verse.Sol.pdf
Why should Emperor Conrad lead the crusades Use bible verse.Sol.pdfWhy should Emperor Conrad lead the crusades Use bible verse.Sol.pdf
Why should Emperor Conrad lead the crusades Use bible verse.Sol.pdf
feelingspaldi
 
WHICH PERSON WOULD GENERLLY BE TREATED AS A MATERIAL PARTICIPANT IN .pdf
WHICH PERSON WOULD GENERLLY BE TREATED AS A MATERIAL PARTICIPANT IN .pdfWHICH PERSON WOULD GENERLLY BE TREATED AS A MATERIAL PARTICIPANT IN .pdf
WHICH PERSON WOULD GENERLLY BE TREATED AS A MATERIAL PARTICIPANT IN .pdf
feelingspaldi
 
Which of the following are widely recognized disadvantages to the Eur.pdf
Which of the following are widely recognized disadvantages to the Eur.pdfWhich of the following are widely recognized disadvantages to the Eur.pdf
Which of the following are widely recognized disadvantages to the Eur.pdf
feelingspaldi
 
What is the function of a rhizoid Describe asexual and sexual repro.pdf
What is the function of a rhizoid  Describe asexual and sexual repro.pdfWhat is the function of a rhizoid  Describe asexual and sexual repro.pdf
What is the function of a rhizoid Describe asexual and sexual repro.pdf
feelingspaldi
 
We define a relation on set of Whole NumbersW={0,1,2,3…} As follow.pdf
We define a relation on set of Whole NumbersW={0,1,2,3…} As follow.pdfWe define a relation on set of Whole NumbersW={0,1,2,3…} As follow.pdf
We define a relation on set of Whole NumbersW={0,1,2,3…} As follow.pdf
feelingspaldi
 
What does the cutting-plane line represent List and explain seven d.pdf
What does the cutting-plane line represent  List and explain seven d.pdfWhat does the cutting-plane line represent  List and explain seven d.pdf
What does the cutting-plane line represent List and explain seven d.pdf
feelingspaldi
 
True or False The employment relationship that is typical of modern.pdf
True or False The employment relationship that is typical of modern.pdfTrue or False The employment relationship that is typical of modern.pdf
True or False The employment relationship that is typical of modern.pdf
feelingspaldi
 
The following monthly data are taken from Ramirez Company at July 31.pdf
The following monthly data are taken from Ramirez Company at July 31.pdfThe following monthly data are taken from Ramirez Company at July 31.pdf
The following monthly data are taken from Ramirez Company at July 31.pdf
feelingspaldi
 
State the reasons for the current drought in South Africa. Describe .pdf
State the reasons for the current drought in South Africa. Describe .pdfState the reasons for the current drought in South Africa. Describe .pdf
State the reasons for the current drought in South Africa. Describe .pdf
feelingspaldi
 
Select the true statements concerning seeds.A Seeds allow for dor.pdf
Select the true statements concerning seeds.A Seeds allow for dor.pdfSelect the true statements concerning seeds.A Seeds allow for dor.pdf
Select the true statements concerning seeds.A Seeds allow for dor.pdf
feelingspaldi
 
Russian dude. Formulated the ____ hypothesis regarding prebioisSo.pdf
Russian dude. Formulated the ____ hypothesis regarding prebioisSo.pdfRussian dude. Formulated the ____ hypothesis regarding prebioisSo.pdf
Russian dude. Formulated the ____ hypothesis regarding prebioisSo.pdf
feelingspaldi
 
Robin Hartshorne• a biography of the mathematician• a descriptio.pdf
Robin Hartshorne• a biography of the mathematician• a descriptio.pdfRobin Hartshorne• a biography of the mathematician• a descriptio.pdf
Robin Hartshorne• a biography of the mathematician• a descriptio.pdf
feelingspaldi
 
Question 7 Write the expression in expanded form. 81n x + In y O4 Inx.pdf
Question 7 Write the expression in expanded form. 81n x + In y O4 Inx.pdfQuestion 7 Write the expression in expanded form. 81n x + In y O4 Inx.pdf
Question 7 Write the expression in expanded form. 81n x + In y O4 Inx.pdf
feelingspaldi
 
Position of birds eating sunflower seed is the niche dimension we.pdf
Position of birds eating sunflower seed is the niche dimension we.pdfPosition of birds eating sunflower seed is the niche dimension we.pdf
Position of birds eating sunflower seed is the niche dimension we.pdf
feelingspaldi
 
Physical Security Plan1.Identify the role of environmental control.pdf
Physical Security Plan1.Identify the role of environmental control.pdfPhysical Security Plan1.Identify the role of environmental control.pdf
Physical Security Plan1.Identify the role of environmental control.pdf
feelingspaldi
 
Part I. True or False Place a T or an F, whichever you consider cor.pdf
Part I. True or False Place a T or an F, whichever you consider cor.pdfPart I. True or False Place a T or an F, whichever you consider cor.pdf
Part I. True or False Place a T or an F, whichever you consider cor.pdf
feelingspaldi
 
Module 03 Discussion - Musics Impact on Baby Boomers.pdf
Module 03 Discussion - Musics Impact on Baby Boomers.pdfModule 03 Discussion - Musics Impact on Baby Boomers.pdf
Module 03 Discussion - Musics Impact on Baby Boomers.pdf
feelingspaldi
 

More from feelingspaldi (20)

You have just been hired as an information security engineer for a l.pdf
You have just been hired as an information security engineer for a l.pdfYou have just been hired as an information security engineer for a l.pdf
You have just been hired as an information security engineer for a l.pdf
 
Write an essay consists of 5 paragraphs (comparing between a city and.pdf
Write an essay consists of 5 paragraphs (comparing between a city and.pdfWrite an essay consists of 5 paragraphs (comparing between a city and.pdf
Write an essay consists of 5 paragraphs (comparing between a city and.pdf
 
Why is Antitrust activity so harmful to consumers and the economy W.pdf
Why is Antitrust activity so harmful to consumers and the economy W.pdfWhy is Antitrust activity so harmful to consumers and the economy W.pdf
Why is Antitrust activity so harmful to consumers and the economy W.pdf
 
Why should Emperor Conrad lead the crusades Use bible verse.Sol.pdf
Why should Emperor Conrad lead the crusades Use bible verse.Sol.pdfWhy should Emperor Conrad lead the crusades Use bible verse.Sol.pdf
Why should Emperor Conrad lead the crusades Use bible verse.Sol.pdf
 
WHICH PERSON WOULD GENERLLY BE TREATED AS A MATERIAL PARTICIPANT IN .pdf
WHICH PERSON WOULD GENERLLY BE TREATED AS A MATERIAL PARTICIPANT IN .pdfWHICH PERSON WOULD GENERLLY BE TREATED AS A MATERIAL PARTICIPANT IN .pdf
WHICH PERSON WOULD GENERLLY BE TREATED AS A MATERIAL PARTICIPANT IN .pdf
 
Which of the following are widely recognized disadvantages to the Eur.pdf
Which of the following are widely recognized disadvantages to the Eur.pdfWhich of the following are widely recognized disadvantages to the Eur.pdf
Which of the following are widely recognized disadvantages to the Eur.pdf
 
What is the function of a rhizoid Describe asexual and sexual repro.pdf
What is the function of a rhizoid  Describe asexual and sexual repro.pdfWhat is the function of a rhizoid  Describe asexual and sexual repro.pdf
What is the function of a rhizoid Describe asexual and sexual repro.pdf
 
We define a relation on set of Whole NumbersW={0,1,2,3…} As follow.pdf
We define a relation on set of Whole NumbersW={0,1,2,3…} As follow.pdfWe define a relation on set of Whole NumbersW={0,1,2,3…} As follow.pdf
We define a relation on set of Whole NumbersW={0,1,2,3…} As follow.pdf
 
What does the cutting-plane line represent List and explain seven d.pdf
What does the cutting-plane line represent  List and explain seven d.pdfWhat does the cutting-plane line represent  List and explain seven d.pdf
What does the cutting-plane line represent List and explain seven d.pdf
 
True or False The employment relationship that is typical of modern.pdf
True or False The employment relationship that is typical of modern.pdfTrue or False The employment relationship that is typical of modern.pdf
True or False The employment relationship that is typical of modern.pdf
 
The following monthly data are taken from Ramirez Company at July 31.pdf
The following monthly data are taken from Ramirez Company at July 31.pdfThe following monthly data are taken from Ramirez Company at July 31.pdf
The following monthly data are taken from Ramirez Company at July 31.pdf
 
State the reasons for the current drought in South Africa. Describe .pdf
State the reasons for the current drought in South Africa. Describe .pdfState the reasons for the current drought in South Africa. Describe .pdf
State the reasons for the current drought in South Africa. Describe .pdf
 
Select the true statements concerning seeds.A Seeds allow for dor.pdf
Select the true statements concerning seeds.A Seeds allow for dor.pdfSelect the true statements concerning seeds.A Seeds allow for dor.pdf
Select the true statements concerning seeds.A Seeds allow for dor.pdf
 
Russian dude. Formulated the ____ hypothesis regarding prebioisSo.pdf
Russian dude. Formulated the ____ hypothesis regarding prebioisSo.pdfRussian dude. Formulated the ____ hypothesis regarding prebioisSo.pdf
Russian dude. Formulated the ____ hypothesis regarding prebioisSo.pdf
 
Robin Hartshorne• a biography of the mathematician• a descriptio.pdf
Robin Hartshorne• a biography of the mathematician• a descriptio.pdfRobin Hartshorne• a biography of the mathematician• a descriptio.pdf
Robin Hartshorne• a biography of the mathematician• a descriptio.pdf
 
Question 7 Write the expression in expanded form. 81n x + In y O4 Inx.pdf
Question 7 Write the expression in expanded form. 81n x + In y O4 Inx.pdfQuestion 7 Write the expression in expanded form. 81n x + In y O4 Inx.pdf
Question 7 Write the expression in expanded form. 81n x + In y O4 Inx.pdf
 
Position of birds eating sunflower seed is the niche dimension we.pdf
Position of birds eating sunflower seed is the niche dimension we.pdfPosition of birds eating sunflower seed is the niche dimension we.pdf
Position of birds eating sunflower seed is the niche dimension we.pdf
 
Physical Security Plan1.Identify the role of environmental control.pdf
Physical Security Plan1.Identify the role of environmental control.pdfPhysical Security Plan1.Identify the role of environmental control.pdf
Physical Security Plan1.Identify the role of environmental control.pdf
 
Part I. True or False Place a T or an F, whichever you consider cor.pdf
Part I. True or False Place a T or an F, whichever you consider cor.pdfPart I. True or False Place a T or an F, whichever you consider cor.pdf
Part I. True or False Place a T or an F, whichever you consider cor.pdf
 
Module 03 Discussion - Musics Impact on Baby Boomers.pdf
Module 03 Discussion - Musics Impact on Baby Boomers.pdfModule 03 Discussion - Musics Impact on Baby Boomers.pdf
Module 03 Discussion - Musics Impact on Baby Boomers.pdf
 

Recently uploaded

The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 

Recently uploaded (20)

The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 

Create a C# applicationYou are to create a class object called “Em.pdf

  • 1. Create a C# application You are to create a class object called “Employee” which included eight private variables: firstN lastN dNum wage: holds how much the person makes per hour weekHrsWkd: holds how many total hours the person worked each week. regHrsAmt: initialize to a fixed amount of 40 using constructor. regPay otPay After going over the regular hours, the employee gets 1.5x the wage for each additional hour worked. Methods: constructor properties CalcPay(): Calculate the regular pay and overtime pay. Create an “EmployeeDemo” class. In the main function, the program should ask the user the number of employee in the company and create a 2-dimensional dynamic array (number of employee by 4 weeks). Then, the program should ask user to enter each employee’s information and the amount of hours they worked weekly. The program shows a menu with employee name for user to choose which employee to display the following information: How much the person totally made How much of paycheck is regular pay How much of paycheck is overtime pay Solution using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace Employee {
  • 2. public enum EmployeeType {GROUPA, GROUPB, GROUPC, GROUPD}; public struct EmployeeSalaryInfo { public float hourlyWage; public int monthlyHours; public float baseSalary; public int numSales; public EmployeeSalaryInfo( EmployeeType eme) { this.hourlyWage = 0; this.monthlyHours = 0; this.baseSalary = 0; this.numSales = 0; } } class Program { static void Main(string[] args) { Console.WriteLine("Welcome to the Employee System"); EmployeeArray empArray = new EmployeeArray(); int continueRunning = 1; do Console.WriteLine(); Console.WriteLine("Please Enter Your Choice:"); Console.WriteLine("1=Enter new employee"); Console.WriteLine("2=Update existing employee"); Console.WriteLine("3=Delete employee"); Console.WriteLine("4=Print employee list"); Console.WriteLine("Any other number to Exit"); int userChoice = int.Parse(Console.ReadLine());
  • 3. Console.WriteLine(); switch (userChoice) { case 1: Employee emp = CreateNewWorker(); //Asking for employee information by creating a new employee. if (!(empArray.Contains(emp))) //Checking to see that employee does not exist empArray.Add(emp); //If the employee does not exist in the list then we can add it. else Console.WriteLine("Can not add new worker. This worker already exists"); break; case 2: //If user wishes to edit an employee EditEmployee(empArray); break; case 3: DeleteEmployee(empArray); //if user wishes to delete an employee from the list break; case 4: empArray.Print(); break; default: continueRunning = 0; //If user has chosen to exit the system. break; } } while (continueRunning == 1); //Checking to see if to continue running the system } static Employee CreateNewWorker() //Method for creating a new employee. { Employee emp; //A new employee consists of the basic information which is
  • 4. Console.WriteLine("Enter first name:"); //The first name string first = Console.ReadLine(); Console.WriteLine("Enter last name:"); //The family name string last = Console.ReadLine(); Console.WriteLine("Enter birth date in DD/MM/YYYY format"); //and birthday. DateTime bDay = DateTime.Parse(Console.ReadLine()); Console.WriteLine("Is worker 1=Secretary, 2=Sales, 3=Manager, 4=Top Manager?"); //Also asking for the type EmployeeSalaryInfo salInfo = GetSalaryInfo(workerType); //and the salary information emp = new Employee(first, last, bDay, workerType, salInfo); //with all the info can create a new employee return emp; } static void EditEmployee(EmployeeArray employees) //Method for editing an employee and his info { Employee emp = GetEmployeeInfo(); //First getting basic info about employee to edit. EmployeeSalaryInfo salInfo = new TGCEmployeeSalaryInfo(); if (employees.Contains(emp)) //Then checking that list has this employee (if not can not edit) { Console.WriteLine("Has worker position changed? 1=Yes, 2=No"); int changeType = int.Parse(Console.ReadLine()); if (changeType == 1) //If employee type has changed { //then ask for new type Console.WriteLine("Is worker 1=Secretary, 2=Sales, 3=Manager, 4=Top Manager?"); TGCEmployeeType workerType = (TGCEmployeeType)int.Parse(Console.ReadLine()) - 1; salInfo = GetSalaryInfo(workerType); //and then ask for his salary info employees.Replace(emp, workerType, salInfo); //and finally
  • 5. replace the info in the salary list. } else //if type ha not changed { salInfo = GetSalaryInfo(employees.Find(emp)); //then get only the salary info (without the need for the type) employees.Replace(emp, employees.Find(emp), salInfo); //and finally replace the info in the salary list. } } else Console.WriteLine("There is no such employee"); } static Employee GetEmployeeInfo() //A method for getting the basic information about an employee which includes { Console.WriteLine("Enter first name of the employee"); string first = Console.ReadLine(); //His First name Console.WriteLine("Enter last name of the employee"); string last = Console.ReadLine(); //His last name Console.WriteLine("Enter birth date in DD/MM/YYYY format"); DateTime bDay = DateTime.Parse(Console.ReadLine()); //And his birthday Employee emp = new Employee(first, last, bDay); return emp; //and then we can create an emplyee object (without adding him to the list) } static TGCEmployeeSalaryInfo GetSalaryInfo(TGCEmployeeType empType) //A method for getting the salary info about a certain employee type from the user { TGCEmployeeSalaryInfo salInfo = new TGCEmployeeSalaryInfo(empType); switch(empType) //A switch to see what the type is so that the correct questions could be asked { case (EmployeeType)0: //if it is a secretary than ask for hourly wage and number of hours
  • 6. Console.WriteLine("Please Enter Hourly Wage"); salInfo.hourlyWage = float.Parse(Console.ReadLine()); Console.WriteLine("Please Enter Number of Hours Worked"); salInfo.monthlyHours = int.Parse(Console.ReadLine()); break; case (TGCEmployeeType)1: //if it is a sales person than ask for base salary, number of sales and bomus per sale Console.WriteLine("Please Enter Base Salary"); salInfo.baseSalary = float.Parse(Console.ReadLine()); Console.WriteLine("Please Enter Number of Sales"); salInfo.numSales = int.Parse(Console.ReadLine()); Console.WriteLine("Please Enter Bonus per Sale"); salInfo.salaryBonus = float.Parse(Console.ReadLine()); break; case (TGCEmployeeType)2: //if it is a manager than ask for the base salary. The bonus is currently constant as part of the salary info struct Console.WriteLine("Please Enter Base Salary"); salInfo.baseSalary = float.Parse(Console.ReadLine()); break; case (EmployeeType)3: //if it is a top manager than ask for the base salary. The bonus is currently constant as part of the salary info struct Console.WriteLine("Please Enter Base Salary"); salInfo.baseSalary = float.Parse(Console.ReadLine()); break; } return salInfo; } } class Employee //An employee class which includes all the information about an employee, ways to retrieve and set the info, and calculate its salary { string firstName; string familyName; DateTime birthDate; EmployeeType employeeType; EmployeeSalaryInfo employeeSalaryInfo;
  • 7. public Employee(string first, string family, DateTime bDay) //first constructor which creates an employee without his salary info and type. { firstName = first; familyName = family; birthDate = bDay; } public Employee(string first, string family, DateTime bDay, EmployeeType empType, EmployeeSalaryInfo salInfo) //second constructor which creates an employee with all info { firstName = first; familyName = family; birthDate = bDay; employeeType = empType; employeeSalaryInfo = salInfo; } public string FirstName //property method for getting the first name { get { return this.firstName; } } public string FamilyName //property method for getting the last name { get { return this.familyName; } } public DateTime BirthDate //property method for getting the birth date { get { return this.birthDate;
  • 8. } } public EmployeeType EmployeeType //property method for getting the type of employee or setting it (in case it changed) { get { return this.employeeType; } set { this.employeeType = value; } } public EmployeeSalaryInfo SalaryInfo //property method for setting new salary information for the employee { set { this.employeeSalaryInfo = value; } } public float CalcSalary() //method for calculating the employee's salary { float salary=0; switch(employeeType) { case (EmployeeType)0: //if employee is a secretary than multiply wage per hour by hours worked salary = (employeeSalaryInfo.hourlyWage) * (employeeSalaryInfo.monthlyHours); break; case ( EmployeeType)1: //if employee is a sales person than multiply number of sales by bonus per sale and add that to the base salary salary = ((employeeSalaryInfo.baseSalary) + (employeeSalaryInfo.numSales * (employeeSalaryInfo.salaryBonus))); break;
  • 9. case (EmployeeType)2: //if employee is a manager than add the bonus to the base salary salary = (employeeSalaryInfo.baseSalary) + (employeeSalaryInfo.salaryBonus); break; case ( EmployeeType)3: //if employee is a top manager than add the bonus to the base salary salary = (employeeSalaryInfo.baseSalary) + (employeeSalaryInfo.salaryBonus); break; } return salary; } } public void Print() //a method for printing all employees in the list icluding name, birthdate, type and salary. { Console.WriteLine("Family NametFirst NametBirth DatetWorker TypetSalary"); Console.WriteLine("-----------t----------t----------t-----------t------"); foreach ( Employee e in employees) Console.WriteLine("{0}t{1}t{2}t{3}t{4}", e.FamilyName.PadRight(11), e.FirstName.PadRight(10), e.BirthDate.ToShortDateString(), e.EmployeeType.ToString().PadRight(11), e.CalcSalary()); Console.WriteLine(); } } }