SALARY CLASS: using System; using System.Collections.Generic; using System.Linq;
ID: 3630570 • Letter: S
Question
SALARY CLASS:using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//TODO implement a complete class header
namespace Payroll
{
[Serializable]
public class Salary : Employee
{
#region "Variables"
private const double MIN_SALARY = 50000;
private const double MAX_SALARY = 250000;
private const double NUMBER_WEEKS = 52;
private double annualSalary = MIN_SALARY;
#endregion
#region "Constructors"
public Salary()
: base()
{
//TODO implement and initialize class variables
}
public Salary(string firstName, string lastName, Employee.Type type, double salary)
: base(firstName, lastName, type)
{
//TODO implement and initialize class variables
}
#endregion
#region "Properties"
public double AnnualSalary
{
get { return annualSalary; }
set
{
//TODO implement and ensure salary is between the minimum and maximum
}
}
#endregion
#region "Polymorphic Methods"
public override double WeeklyPay()
{
//TODO implement
return (double) 0;
}
public override string ToString()
{
//TODO implement and ensure to invoke the base class ToString methods
return "";
}
#endregion
}
}
Need to fill in the TODO area's in this program. Use the UML Diagram link below to help and the section that this cam from.
* Salary class
// calculate and return the weekly pay
return annualSalary / 52.0;
http://www.cramster.com/answers-oct-11/computer-science/ilab-7-7-business-applicat-ilab-7-7-business-applicationsubmit-assig_1540045.aspx?rec=0
Explanation / Answer
namespace Payroll { [Serializable] public class Salary : Employee { #region "Variables" private const double MIN_SALARY = 50000; private const double MAX_SALARY = 250000; private const double NUMBER_WEEKS = 52; private double annualSalary = MIN_SALARY; #endregion #region "Constructors" public Salary() : this(string.Empty, string.Empty, Type.Salary, MIN_SALARY) { } public Salary(string firstName, string lastName, Employee.Type type, double salary) : base(firstName, lastName, type) { AnnualSalary = salary; } #endregion #region "Properties" public double AnnualSalary { get { return annualSalary; } set { //TODO implement and ensure salary is between the minimum and maximum } } #endregion #region "Polymorphic Methods" public override double WeeklyPay() { return annualSalary / 52.0; } public override string ToString() { return base.ToString() + ", Salary: " + annualSalary.ToString("C2"); } #endregion } }
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.