Free Essay

Employee Increment

In:

Submitted By smtutu
Words 565
Pages 3
I have written a code that needs to increment my employee object by 1 for each instance of the class Employee.I am using a variable private static int numEmployee = 0;

My program runs fine, but it keeps giving me total employees = "2" and "3" for employee1 and employee2, and I am not sure what I am doing wrong. Please look at this code and offer any help !!!

This is my first post, so not sure if this format is correct or not. I used Visual Studio 2010 for C# to compile.

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace Help

{ class Employee
{
private string firstName; private string lastName; private char gender; private int dependents; private double annualSalary; private double pay; public static int numEmployees = 0; // created static variable

public const string DEFAULT_FIRST = " not given"; public const string DEFAULT_LAST = " not given"; public const char DEFAULT_GENDER = 'U'; public const int DEFAULT_DEPENDENTS = 0; private const double DEFAULT_ANNUALSALARY = 20000;

public Employee()
{
FirstName = DEFAULT_FIRST;
LastName = DEFAULT_LAST;
Gender = DEFAULT_GENDER;
Dependents = DEFAULT_DEPENDENTS;
AnnualSalary = DEFAULT_ANNUALSALARY; numEmployees++; // incremented numEmployees

}

public Employee(string first, string last, char gen, int dep, double salary)
{

DisplayEmployeeInformation(first, last, gen, dep, salary); numEmployees++; //incremented numEmployees

}

~Employee()
{
Console.WriteLine("Cancel the employee!!");
}

public string FirstName
{
get
{ return firstName; } set {firstName = value;}
}
public string LastName
{
get
{ return lastName; } set {lastName = value;}
}
public char Gender
{
get
{ return gender; } set {gender = value;}

} public int Dependents
{
get
{ return dependents; } set { dependents = value;}
}

public double AnnualSalary
{
get { return annualSalary; } set { if(value > 19999) annualSalary = value; else annualSalary = DEFAULT_ANNUALSALARY;
}
} public static int GetNumEmployees() //
{
return numEmployees;
}
public double CalculatePay()
{
return (annualSalary / 52);

} public override string ToString()
{
string str;

str = "Employee AnnualSalary: $" + AnnualSalary.ToString("N2") + "\n "; return str;
}
public void DisplayEmployeeInformation(string first, string last, char gen, int dep, double salary)
{

Console.WriteLine("First Name: " + first);
Console.WriteLine("Last Name: " + last);
Console.WriteLine("Gender: " + gen);
Console.WriteLine("Dependents: " + dep);
Console.WriteLine("Annual Salary:$ " + salary.ToString("N2")); annualSalary = salary; pay = CalculatePay();
Console.WriteLine("Employee Weekly Pay:$ " + pay.ToString("N2"));
Console.WriteLine("Total Employees:" + numEmployees);
}

}

}

***** start of Program.cs *****

using System; using System.Collections.Generic; using System.Linq; using System.Text;

namespace Help
{
public class Program
{
static void Main(string[] args)
{

DisplayApplicationInformation();
DisplayDivider("Start Program");

//Employee.DisplayEmployeeInformation();
DisplayDivider("Employee Information");

DisplayDivider("Creating and testing employee1");
Employee employee1 = new Employee();
Employee.GetNumEmployees(); // is this where we access the employee1.FirstName = GetInput("First Name"); employee1.LastName = GetInput("Last Name"); employee1.Gender = char.Parse(GetInput("Gender")); employee1.Dependents = int.Parse(GetInput("Dependents")); employee1.AnnualSalary = double.Parse(GetInput("Salary"));

DisplayDivider("Creating and testing employee2");
Employee employee2 = new Employee();
Employee.GetNumEmployees();
employee2.FirstName = GetInput("First Name"); employee2.LastName = GetInput("Last Name"); employee2.Gender = char.Parse(GetInput("Gender")); employee2.Dependents = int.Parse(GetInput("Dependents")); employee2.AnnualSalary = double.Parse(GetInput("Salary"));

Console.Clear();
Employee employee1write = new Employee(employee1.FirstName, employee1.LastName, employee1.Gender, employee1.Dependents, employee1.AnnualSalary);
Console.WriteLine();
Employee employee2write = new Employee(employee2.FirstName, employee2.LastName, employee2.Gender, employee2.Dependents, employee2.AnnualSalary);

TerminateApplication();

} private static void DisplayApplicationInformation()
{
Console.WriteLine("Welcome to Employee Class Program");
Console.WriteLine("CIS247, Week 3 Lab");
Console.WriteLine("Name: Chuck");
Console.WriteLine("This program will increment the employee class to count the employees");
Console.WriteLine();
}

private static void DisplayDivider(string outputTitle)
{
Console.WriteLine("***************" + outputTitle + " " + "***************");
}

private static string GetInput(string inputType)
{
string strInput = String.Empty;
Console.Write(" Please enter " + inputType + " : "); strInput = Console.ReadLine();

return strInput;
}

private static void TerminateApplication()
{
DisplayDivider("Program Termination");
Console.Write("Thank You! Please press any key to terminate the program");
Console.ReadKey();
}
}
}

Similar Documents

Free Essay

Meeting the Challenges of Stakeholder Engagement and Communication: Lessons from Teacher Incentive Fund Grantees

...Meeting the Challenges of Stakeholder Engagement and Communication: Lessons From Teacher Incentive Fund Grantees The Harvesting Project Julia E. Koppich J. Koppich & Associates Meeting the Challenges of Stakeholder Engagement and Communication: Lessons From Teacher Incentive Fund Grantees As of August 2010, a total of 33 states, school districts, charter school coalitions, and other education organizations¹ had received Teacher Incentive Funds (TIF) to redesign compensation programs for teachers and principals. The U.S. Department of Education named a new cohort of TIF grantees on September 23, 2010. TIF grantees have faced a number of challenges as they have worked to design and implement new educator pay programs. Among the most demanding challenges has been developing a targeted set of metrics around available and manageable data. Grantees use these metrics to measure teacher or principal effectiveness and assign pay. Recently, grantees have made it a priority to sustain operation programs once their federal funding expires. TIF grantees have also found, often belatedly and unexpectedly, that effective stakeholder engagement and communication are challenging and essential to the success of their pay programs. Stakeholder engagement helps to create buy-in and initial acceptance of the TIF plan. It allows different voices and perspectives to be heard and recognized as new approaches to compensation develop. Communication provides the synergy to broaden buy-in and...

Words: 7252 - Pages: 30

Premium Essay

Revamping Human Resource

...department. Azahar was keen to meet her to discuss the issue. Azahar Mansor was the recently appointed Human Resource manager of the Kameha Medical Center, Ipoh. He got his Master’s degree in USM and worked in a Pharma company before joining here. Azahar Mansor, was head hunted to fill in a void that was left behind by Madam Kamisah, who worked there for 3 years, in August 2012. Soon he realized that poor employer benefits led to continuous exodus of trained staff from this health care facility to the neighboring centers, which became an ever-perpetual problem of training the new staff who joined there. He faced the task of retaining staff and finding ways to plug the leak of experienced staff from Kameha Medical Center. By addressing the employee benefit crisis in this he would be able to tackle the task at hand. Organization background: Kameha medical center was established in 1999, Perak. It is a 232-bedded hospital and is equipped with the state of the art medical facilities. There are about 430 staffs in the hospital, which includes management, clinical and support services. It is a tertiary hospital specialized in spine surgery, cardiac surgery and cancer treatment. The human resource is a micro unit in Kameha Medical Center with Azahar and Amir being in charge of it. The human resource management faces tough time with complains from staff regarding archaic medical benefits that was last revised 5 years ago....

Words: 1345 - Pages: 6

Premium Essay

Compensation and Benefit Management: a Study on Pacific Bangladesh Telecom Limited (Citycell)

...Compensation and Benefit Management: A Study on Pacific Bangladesh Telecom Limited (CITYCELL) Submitted By: Submitted To: Mr. A.K. Nazmul In Partial Satisfaction of Requirements for the Human Resource Management Course Fall, 2008 Dhaka, Bangladesh Letter of Transmittal Date: 27th November, 2008 To Mr. A.K. Nazmul Faculty, School of Business American International University- Bangladesh. H: 83/B, R: 4, Kamal Ataturk Avenue, Banani, Dhaka-1213 Subject: Submission of term paper. Sir, We are glad to submit herewith the report for Human Resource Management .We are grateful to you for assigning this work as this has given us an opportunity to make a practical demonstration to relate our classroom theoretical knowledge to a virtual real life scenario and thus broaden our applied knowledge. We have all along enjoyed our working on this project and we shell feel glad to give any further clarification, you desire from us on this paper. With Regards, Acknowledgement I specially thank our faculty Mr. A.K. Nazmul for giving us this wonderful opportunity and approval to submit a formal report...

Words: 5113 - Pages: 21

Premium Essay

Strategic Workforce Management

...Strategic workforce management Name Institution Course Date Strategic workforce management How reward, benefits and employee development systems are aligned with strategy in my organization Notably, organizational strategies that are not aligned with reward, benefit and employee development usually lead ineffectiveness and failure to meet set target and objectives. My organization has a reward program that is designed to support our unique human capital strategy. Instead of replicating reward practices of other organizations, my organization has trained our employees to adapt to our side of business design. Ideally, reward programs that are not strategically integrated and delivered effectively give quite different outcome from original intention. Furthermore, my organization ensures that employee benefits have responsible personnel who do follow up of employees benefit compensation. This ensures that all employees get their benefits without making many trips to the Human Resource department. Finally, our employee development programs always aim at training our employees about the strategies and objectives of our organization. Generally, an effective reward, benefit and employee development integrated with organizational strategies ensure that there is efficient delivery of value in the organization (Heneman, 2002 P 76). A, B and C players according to Huselid, Beatty and Becker According to Huselid, Beatty and Becker A players are...

Words: 885 - Pages: 4

Free Essay

Reward Strategy

...MANAGING A REWARD STRATEGY Top of Form 1 History of Reward The aims of a reward strategy are to try and be systematic about which HR mechanisms attract, retain and motivate staff. Historically the view was that salaries were what attracted a person to an organisation, benefits kept them there, while bonus and incentive schemes motivated them. Reward was regarded as consisting of three distinctive parts: Remuneration - covering such aspects as job evaluation, salary structures and incentive schemes. Benefits - which tend to be offered to all employees irrespective of their grade, such as paid leave, employee assistance programmes or Christmas parties. Perquisites - which are benefits that tend to provided to discrete categories of employees, such as a company car/car allowance, private healthcare or concierge service. 2 Reward Today More recently, this divide between which parts of reward are best suited for attraction and recruitment, retention and motivation has broken down. Modern research shows that individuals are attracted, retained and engaged by a whole range of financial and non-financial rewards and that these can change over time depending on their personal circumstances. The financial elements of a package are not considered particularly important by individuals in some situations. For instance, people at the beginning of their career may be more interested in getting access to training and career development. People at the end of their career are...

Words: 4242 - Pages: 17

Premium Essay

Questionnaire About Private University Teacher's

...help me to assume the Employee Compensation survey. Your personal perception and honest answer is considered vital importance for the success of my study. Your identity and information will be kept confidential. Thank you very much for your time and interest. Precede us to start the survey, please.                   State how long you have been working in your organization? Less than one year: __________ 1- 3years: _________ 3- 5 years: _________ 5- 9 years: __________ More than 10 years: __________ 2) What is your job description?     3) Do you believe that your job profile is benchmarked with the same jobs in the industry and market place? -Yes □ -No   □ 4) How many hours do you work per day?     5) What is your satisfaction level with compensation of your organization?     How the company gives promotion to their employees?   Based on time            Performance            Other          .      Does your company utilize a traditional salary grade system? Yes No If yes, please answer the following questions.   What was your starting salary? 15-25         25-35        35-45       more than 45 Does your company offer salary increment? Yes □ No □ How often is the salary structure reviewed? ____________________ When was the last time it was adjusted? ____________________ By what percentage? ______________% Does your company give a general increase? Yes □ No □ Does your company give a cost of living increase? Yes □ No □     Does your company have a formal employee merit review process...

Words: 444 - Pages: 2

Premium Essay

Ols 379 Exam 1

...employer has strong commitments to maintain a totally or partially nonunion workforce. 2. What is the most frequent method of communicating benefits to employees? How can this method be most effective The employee benefit handbook is the most frequent form of communicating benefits to employees. To be most effective the benefit manual should be accompanied by group meetings and videotape. 3. Which is the most popular empirical method of identifying individual preferences in benefits packages? Explain how this method works The flexible benefit plan is the most popular also known as cafeteria style plan or the super market plan. Employees are allotted a fixed amount of money and permitted to spend that amount in the purchase of benefit options. Employees directly identify the benefits of greatest value to them, and by constraining the dollars employees have to spend, benefits managers are able to control benefits costs. 4. Discuss what psychological contracts mean in employee benefit practices Psychological contracts are an articulation of the exchange relationship between the employer and the employee. A psychological contract has been defined as an employee’s subjective perceptions of the relationship of mutual obligations with the employer and the company. Employee benefits can be a part of the psychological contract employees hold about the employer’s obligations to them in exchange for their work efforts. 5. Briefly discuss how workforce demographic changes can...

Words: 1002 - Pages: 5

Premium Essay

Importance of Compensation Package on Hr Practice by Md. Woahidul Alam Tareq

...Compensation: Compensation Package is an organized practice that involves balancing the work-employee relation by providing monetary and non-monetary benefits to employees. Compensation includes payments such as bonuses, profit sharing, overtime pay, recognition rewards and sales commission. Compensation can also include non-monetary perks such as a company-paid car, company-paid housing and stock options. Compensation is an integral part of human resource management which helps in motivating the employees and improving organizational effectiveness. Importance of Compensation Package: The current competitive conditions in the business world make it difficult to acquire and retain the top talents. Once the organization is able to identify, it can be unable to offer the right pay and to manage the pay increases to retain top talents. The compensation strategy is the extremely important piece of the overall HR Strategy to keep the company competitive and successful. On the other hand, the compensation strategy is important to keep the personnel budget under the control and to manage the jobs in the right salary (pay) brackets. The compensation strategy differentiates the organization on the job market and builds the attractiveness of the company for the top talents. They love to be hired by the attractive organization, they do not like to be hired by the average company offering the same conditions as any other average organization in the...

Words: 915 - Pages: 4

Premium Essay

Jva Corporation Stimulation

...JVA Corporation Simulation: Week-5 To: Robbin Churray By: Kirandeep Badesha Course: MGMT410 DeVry Online Session 2011Rob   Employees will lost bit in amenities and some restriction on the raise of wage and salaries. JVA corporation will save almost 2% to 3% part of their net income that is spent on perks and other amenities. It may affect to employees as they will suffer from raises and other incentives but they will get benefit too as JVA will not lay out of current workers. The implementation of new strategy can affect JVA corp. due to lack of incentives or raises because it can discourage to employees and their productivity and motivation may get low. The international employees will be part of this change also. Recession is affecting every nation so JVA need to implement the changes globally. It does not matter that employees are US based or have international location, the change of strategy will be same for all otherwise it can bring frustration amont other employers and employees. As JVA Corporation is facing 17% net lose in their income and demands to cut the perks from 8 to 5 % so it will be crucial to bring effective change in the compensation system of organization. The crucial aspect of the strategy is that the all the changes that have been mentioned in JVA co-operation will continue until the recession of economy get recovered. It’s clear that the strategy I will refer best matches to the second strategy which needs to focus on “Performance, as...

Words: 648 - Pages: 3

Premium Essay

Compensation and Benfits Plan

...aimed at helping the company close the organization’s current gap and save the organization money in the long run. The incoming CIS programmer is expected to help the company achieve a stress free working environment for the rest of the employees and help the company make more profits from delivering to the company’s expectations. Hiring a new employee calls for implementation of a compensation and benefits plan that meets the needs of both the employee and the hiring organization. Benefits plan are designed to address specific needs and are often not in cash form. There are different approaches that an organization can choose to use while implementing a compensation and benefit plan. One such justifiable approach is one that recommends that the employee get insurance benefits, health and security benefits, vacation pay, stock options, profit sharing, contribution to retirement and pay for time not worked. Benefits are forms of value, apart from payment, that are given to employees in return for their inputs to the organization. There are other forms of intangible benefits that the company can decide to extend to the employee, which includes, appreciation from a boss for work well done, nice office and likelihood for promotion based on performance. Companies provide compensation and benefit plans to the employees in order to attract, improve the retention rate and align employee’s interests with those of other stakeholders. Apart from the incentives offered, multitude...

Words: 870 - Pages: 4

Premium Essay

Tax Law Australia

...gotten under the loyalty rewards are in general not taxable. 2. Exception This rule has exception circumstances where the flyer reward may be taxed, they include; Flight-royalty reward can be subject fringe benefit tax where the individual in personal contract happens to be an employer who is providing the “flyer points” given to worker who happens to be a family member in regards to the employment. This means, Fringe Benefit Tax will only affect where the employee and the employer are family related and that flight reward payments are given in relations with employment.For instance in the Payne’s case 1999 the Federal Court observed that the flight rewards gotten in consumer loyalty promotions are not income meaning that they are not subject to Fringe Benefit Tax. The reason was that the rewards in this case were given because of a personal agreement betweena taxpayer and a company that provided consumer loyalty reward to its customer. Another exception to this rule is the case where the flight rewards are given to an employee or employee’s trustee in an arrangement that emanate from business expenses. Flight rewards received by an individual who offer a service or has gotten the flight reward because of business expenses where the individual give service on the account that he or she is entitled for flight reward.This means, that...

Words: 885 - Pages: 4

Premium Essay

Designing Compensation

...Designing Compensation Systems and Employee Benefits 1. Describe the differences between job analysis and job evaluation and how these practices help establish internally consistent job structures. Job analysis is the fundamental process that creates the support of all human resource activities. It is also explained in a clearer way as the process of gathering, documentation and analyzing information about the work needs for a job. The information collected in a job analysis, and reflected through a job description; contain a description of the framework and the principal requirements of the job, and information about the skills, responsibilities, mental models and methods for job analysis. They include, the Position Analysis, Questionnaires, which converge on generalized human behavior and interviews, task inventories, fundamental job analysis and the job element method. A job analysis gives a goal picture of the job, not the person implementing the job, and as such, provides fundamental information to aid all subsequent and related HR activities, such as recruitment, training, development, performance management and succession planning. Job analysis is the method for acknowledging responsibilities or behaviors that describe a job. Separately from attesting the integrity of selection methods, job analysis is the support of virtually scales every other section of industrial psychology, involving performance appraisal training and human elements. Furthermore, job analysis is...

Words: 1367 - Pages: 6

Free Essay

Payment Systems of Tnb

...of remuneration. Typically, employers also provide some payments to motivate workers to maximize their output. Thus, a remuneration or compensation package consists of several elements, usually a combination of basic pay, incentives and benefits. REMUNERATION PACKAGE There are three (3) remuneration package consist of wages, benefits, incentives. I. Wages -Attractive salary scheme -TNB gives their wages depends on different positions and tasks. II. Benefits -Medical coverage and insurance benefits 24 hours by EWRM -Holiday accommodation -Promotion -Loan benefit : electronics, house, car, motor, computer/ laptop III. Incentives -Reimbursement and allowance -Annual increment and bonuses TNB practices online payment system. They distribute payment by Employee Self Service (ESS). Besides that, TNB also use other method of payment such as ERMS / EHRMS. There are two major system of payment : 1. Time-related systems 2. Piece-rated systems TNB implement Time-related systems, wages are paid for a set period of work monthly basis. The pay varies with the number of hours worked and not with the output because TNB is not an output based organization. Time-related systems are probably the most widely used because they are easy to understand and administer and the worker is assured of a steady income. A time-related system...

Words: 712 - Pages: 3

Premium Essay

Employee Benefits

...MFRS 119 Employee Benefits MFRS 119 define employee benefits as to prescribe the accounting and disclosure by employers for employee benefits. Thus, it replaces MASB Approved Accounting Standard IAS 19 Accounting for Retirement Benefits in the Financial Statements of Employees. The major changes from old IAS 19 are set out in the Basis for Conclusions. The Standard does not deal with reporting by employee benefit plans (see FRS 126 Accounting and Reporting by Retirement Benefit Plans ). From MFRS 119, there are four categories of employee benefits to be identified which are: (a) short-term employee benefits, such as wages, salaries and social security contributions, paid annual leave and paid sick leave, profit-sharing and bonuses (if payable within twelve months of the end of the period) and non-monetary benefits (such as medical care, housing, cars and free or subsidised goods or services) for current employees; (b) post-employment benefits such as pensions, other retirement benefits, post-employment life insurance and post-employment medical care; (c) other long-term employee benefits, including long-service leave or sabbatical leave, jubilee or other long-service benefits, long-term disability benefits and, if they are payable twelve months or more after the end of the period, profit-sharing, bonuses and deferred compensation; and (d) termination benefits. 3.1 Accounting Policy Used on MFRS 119 Employee Benefits for AZRB AZRB act or implement the employee benefits...

Words: 2066 - Pages: 9

Premium Essay

Compensation Strategies

...Compensation Strategies Table of Contents Executive Summary 3 Introduction 5 Research Findings 6 Health Benefits 6 Retirement Planning 7 Employee Rewards and Incentives 8 Recommendations 10 Conclusion 11 References 12 Executive Summary We need to re-evaluate our current employee package. Our compensation strategy needs an entire tune-up. We do not offer competitive benefits that will entice the type of employees we want working for our company on a long-term basis. A new, improved, and luring employee benefit package will help set us apart from our competition. Our current benefits policy includes: Paid vacation for salaried employees only after 1 full year of continuous service, paid sick days for salaried employees only after 1 full year of continuous service, medical and dental only to all employees after 6 months of continuous service, holiday dinner for corporate employees and their spouse/domestic partner. We can improve these areas and add some other options to our current employee package, Our current health benefits are through an HMO, which is the best option at this time. Perhaps in the future when we have become a 500+ employee company we can look at the other option, a PPO coverage with an additional option to include an HSA account. Our current HMO plan provides coverage with a small co-payment and a 20/80 % coverage with a $1000 annual deductible. The only way I can see right now to...

Words: 3032 - Pages: 13