Archives from S:\ Drive
Good to keep around methinks
This commit is contained in:
1 parent
eadaf70b9e
commit
6dd63cc439
606 files changed
+50212
No files matched your search
@@ -0,0 +1,20 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Project2", "Project2\Project2.csproj", "{FFA33A1C-42BF-4496-A1B4-1A00294803D4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{FFA33A1C-42BF-4496-A1B4-1A00294803D4}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{FFA33A1C-42BF-4496-A1B4-1A00294803D4}.Debug|x86.Build.0 = Debug|x86
|
||||
{FFA33A1C-42BF-4496-A1B4-1A00294803D4}.Release|x86.ActiveCfg = Release|x86
|
||||
{FFA33A1C-42BF-4496-A1B4-1A00294803D4}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,43 @@
|
||||
/*****************************************************************************
|
||||
* Project 2 will implement a payroll system using abstract classes. *
|
||||
* *
|
||||
* A company pays its employees on a weekly basis. The employees are of four *
|
||||
* types: Salaried employees are paid a fixed weekly salary regardless of the *
|
||||
* number of hours worked, hourly employees are paid by the hour and receive *
|
||||
* overtime pay for all hours worked in excess of 40 hours, commission *
|
||||
* employees are paid a percentage of their sales, and salaried commission *
|
||||
* employees receive a base salary plus a percentage of their sales. For the *
|
||||
* current pay period, the company has decided to reward salaried-commission *
|
||||
* employees by adding 10% to their base salaries. The company wants to *
|
||||
* implement a C# application that performs its payroll calculations *
|
||||
* polymorphically. *
|
||||
* *
|
||||
* Abstract base class Employee declares the “interface” to the hierarchy— *
|
||||
* that is, the set of methods that an application can invoke on all *
|
||||
* employee objects. Each employee, regardless of the way his earnings are *
|
||||
* calculated has a first name, a last name and a social security number, so *
|
||||
* private instance variables firstName, lastName and socialSecurityNumber *
|
||||
* appear in abstract base class Employee. *
|
||||
* *
|
||||
* Class Employee provides methods Earnings and ToString, in addition to the *
|
||||
* properties that manipulate Employee’s instance variables. An Earnings *
|
||||
* method certainly applies to all employees. But each earnings calculation *
|
||||
* depends on the employee’s class. So we declare Earnings as abstract in *
|
||||
* base class Employee. Each derived class overrides Earnings with an *
|
||||
* appropriate implementation. To calculate an employee’s earnings, the *
|
||||
* application assigns a reference to the employee’s object to a base class *
|
||||
* Employee variable, then invokes the Earnings method on that variable. *
|
||||
* You will maintain an array of Employee variables, each of which holds a *
|
||||
* reference to an Employee object. The application iterates through the *
|
||||
* array and calls method Earnings for each Employee object. C# processes *
|
||||
* theses method calls polymorphically. Including Earnings as an abstract *
|
||||
* method in Employee forces every directly derived class of Employee to *
|
||||
* override Earnings with a method that performs an appropriate pay *
|
||||
* calculation. *
|
||||
* *
|
||||
* Method ToString in class Employee returns a string containing the first *
|
||||
* name, last name, and social security number of the employee. Each derived *
|
||||
* class of Employee overrides method ToString to create a string *
|
||||
* representation of an object of that class containing the employee’s type, *
|
||||
* followed by the rest of the employee’s information. *
|
||||
*****************************************************************************/
|
||||
@@ -0,0 +1,43 @@
|
||||
/*****************************************************************************
|
||||
* Project: 2 - Payroll *
|
||||
* Description: Implement a payroll system using abstract classes *
|
||||
* Author: Amrit Panesar - 77260 *
|
||||
* License: Public Domain *
|
||||
* File description: Contains the member variables and functions for hybrid *
|
||||
* commission/salary based employees. *
|
||||
* For further description please see ARCHITECTURE.txt *
|
||||
*****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Project2
|
||||
{
|
||||
public class BasePlusCommissionEmployee : CommissionEmployee
|
||||
{
|
||||
// overloaded constructor to call the Commission Employee's overloaded constructor
|
||||
public BasePlusCommissionEmployee(string FirstName, string LastName, string SSN, double ComissionRate, decimal GrossSales, decimal basesalary)
|
||||
: base(FirstName, LastName, SSN, ComissionRate, GrossSales)
|
||||
{
|
||||
BaseSalary = basesalary;
|
||||
}
|
||||
|
||||
public decimal BaseSalary { get; set; }
|
||||
|
||||
public override decimal Earnings()
|
||||
{
|
||||
// a salary/commission employee's wage is their salary + commission rate * gross sales
|
||||
return (((decimal)ComissionRate * GrossSales) + BaseSalary);
|
||||
}
|
||||
|
||||
// override the tostring method.
|
||||
public override string ToString()
|
||||
{
|
||||
// report employee tostring, gross sales, commission rate, and base salary
|
||||
return String.Format("base salaried commission employee: {0} {1}\nssn: {2}\ngross sales: {3}\ncommission rate: {4}\nbase salary: {5}\nearnings: {6}\n", FirstName, LastName, SocialSecuityNumber, GrossSales.ToString("C"), ComissionRate.ToString("F2"), BaseSalary.ToString("C"), Earnings().ToString("C"));
|
||||
// NOTE: we couldn't use the base.tostring method because it outputs commission employee strings.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*****************************************************************************
|
||||
* Project: 2 - Payroll *
|
||||
* Description: Implement a payroll system using abstract classes *
|
||||
* Author: Amrit Panesar - 77260 *
|
||||
* License: Public Domain *
|
||||
* File description: Contains the member variables and functions for *
|
||||
* commission based employees. *
|
||||
* For further description please see ARCHITECTURE.txt *
|
||||
*****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Project2
|
||||
{
|
||||
public class CommissionEmployee : Employee
|
||||
{
|
||||
// the main overloaded constructor, also call the base class Employee with it's overloaded constructor.
|
||||
public CommissionEmployee(string FirstName, string LastName, string SSN, double comissionrate, decimal grosssales ) : base( FirstName, LastName, SSN)
|
||||
{
|
||||
ComissionRate = comissionrate;
|
||||
GrossSales = grosssales;
|
||||
}
|
||||
|
||||
// constructor to pass an employee and arguments, if necessary.
|
||||
public CommissionEmployee(Employee empn, double comissionrate, decimal grosssales) : base (empn)
|
||||
{
|
||||
ComissionRate = comissionrate;
|
||||
GrossSales = grosssales;
|
||||
}
|
||||
|
||||
// constructor to pass an entire commission employee if necessary.
|
||||
public CommissionEmployee(CommissionEmployee empn) : base (empn)
|
||||
{
|
||||
ComissionRate = empn.ComissionRate;
|
||||
GrossSales = empn.GrossSales;
|
||||
}
|
||||
|
||||
public double ComissionRate { get; set; }
|
||||
public decimal GrossSales { get; set; }
|
||||
|
||||
public override decimal Earnings()
|
||||
{
|
||||
// a commission employee's earnings are the commission rate * gross sales
|
||||
return ((decimal)ComissionRate * GrossSales);
|
||||
}
|
||||
|
||||
// override the tostring method
|
||||
public override string ToString()
|
||||
{
|
||||
// the base tostring, gross sales, commission rate, and earnings
|
||||
return String.Format("commission {0}\ngross sales: {1}\ncommission rate: {2}\nearnings: {3}\n", base.ToString(), GrossSales.ToString("C"), ComissionRate.ToString("F2"), Earnings().ToString("C"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*****************************************************************************
|
||||
* Project: 2 - Payroll *
|
||||
* Description: Impliment a payroll system using abstract classes *
|
||||
* Author: Amrit Panesar - 77260 *
|
||||
* License: Public Domain *
|
||||
* File description: Houses the main driver for the program. Instantiates an *
|
||||
* array of 10 Employees that demonstrates polymorphic behavior *
|
||||
* For further description please see ARCHITECTURE.txt *
|
||||
*****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Project2
|
||||
{
|
||||
public abstract class Employee
|
||||
{
|
||||
// empty constructor, don't do anything.
|
||||
public Employee() { }
|
||||
|
||||
// main constructor, each value as a parameter.
|
||||
public Employee(string fname, string lname, string ssn)
|
||||
{
|
||||
FirstName = fname; LastName = lname; SocialSecuityNumber = ssn;
|
||||
}
|
||||
|
||||
// we have the flexibility to pass in an entire new employee if necessary.
|
||||
public Employee(Employee empn)
|
||||
{
|
||||
FirstName = empn.FirstName; LastName = empn.LastName; SocialSecuityNumber = empn.SocialSecuityNumber;
|
||||
}
|
||||
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string SocialSecuityNumber { get; set; }
|
||||
|
||||
// abstract. must be implemented by all other inherited classes.
|
||||
public abstract decimal Earnings();
|
||||
|
||||
// override the tostring. this is the base tostring.
|
||||
public override string ToString()
|
||||
{
|
||||
// The standard employee: employee first name, last name, and social security number
|
||||
return String.Format("employee: {0} {1}\nssn: {2}", FirstName, LastName, SocialSecuityNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
/*****************************************************************************
|
||||
* Project: 2 - Payroll *
|
||||
* Description: Implement a payroll system using abstract classes *
|
||||
* Author: Amrit Panesar - 77260 *
|
||||
* License: Public Domain *
|
||||
* File description: Contains the member variables and functions for hourly *
|
||||
* employees. *
|
||||
* For further description please see ARCHITECTURE.txt *
|
||||
*****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Project2
|
||||
{
|
||||
public class HourlyEmployee : Employee
|
||||
{
|
||||
// main constructor. pass variables to the Employee constructor
|
||||
public HourlyEmployee(string FirstName, string LastName, string SSN, decimal wage, double hours) : base(FirstName, LastName, SSN)
|
||||
{
|
||||
Wage = wage;
|
||||
Hours = hours;
|
||||
}
|
||||
|
||||
// We can pass in an employee object and extra variables, if necessary
|
||||
public HourlyEmployee(Employee empn, decimal wage, double hours) : base (empn)
|
||||
{
|
||||
Wage = wage;
|
||||
Hours = hours;
|
||||
}
|
||||
|
||||
// Or we can pass in an entire Hourly Employee and work with that.
|
||||
public HourlyEmployee(HourlyEmployee empn) : base(empn)
|
||||
{
|
||||
Wage = empn.Wage;
|
||||
Hours = empn.Hours;
|
||||
}
|
||||
|
||||
public decimal Wage { get; set; }
|
||||
public double Hours { get; set; }
|
||||
|
||||
public override decimal Earnings()
|
||||
{
|
||||
if (Hours <= 40) // if the employee's hours are less than 40 inclusive
|
||||
{
|
||||
return (Wage * 40); // multiply the wage by 40 hours
|
||||
}
|
||||
else if (Hours > 40) // if the employee's hours are more than 40
|
||||
{
|
||||
return (decimal)(40 * (double)Wage + (Hours - 40) * (double)Wage * 1.5); // the standard wage + time and a half for all hours over 40
|
||||
}
|
||||
else // this should never happen.
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// override the tostring
|
||||
public override string ToString()
|
||||
{
|
||||
//the standard employee tostring, hourly wage, hours worked, and earnings
|
||||
return String.Format("hourly {0}\nhourly wage: {1}\nhours worked: {2}\nearnings: {3}\n", base.ToString(), Wage.ToString("C"), Hours.ToString("F2"), Earnings().ToString("C"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*****************************************************************************
|
||||
* Project: 2 - Payroll *
|
||||
* Description: Implement a payroll system using abstract classes *
|
||||
* Author: Amrit Panesar - 77260 *
|
||||
* License: Public Domain *
|
||||
* File description: Houses the main driver for the program. Instantiates an *
|
||||
* array of 10 Employees that demonstrates polymorphic behavior *
|
||||
* For further description please see ARCHITECTURE.txt *
|
||||
*****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Project2
|
||||
{
|
||||
public partial class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Use an array list to house our employees.
|
||||
ArrayList empn = new ArrayList();
|
||||
|
||||
// generate 5 to 30 random employees..
|
||||
int highOrder = RandNumber(5, 30);
|
||||
|
||||
Console.WriteLine("Generating {0} Employees...", highOrder);
|
||||
|
||||
// loop though the random number above
|
||||
for (int i = 0; i < highOrder; i++)
|
||||
{
|
||||
int thisN = RandNumber() % 5; // Generate a random number between 1 and the max integer size moded by 5 (to generate a number 1-4)
|
||||
switch (thisN)
|
||||
{
|
||||
case 4: // BasePlus
|
||||
empn.Add(new BasePlusCommissionEmployee(GenerateFirstName(), GenerateLastName(), GenerateSSN(), RandDouble(), (decimal)RandDouble(), (decimal)RandDouble()));
|
||||
break;
|
||||
case 3: // Commission
|
||||
empn.Add(new CommissionEmployee(GenerateFirstName(), GenerateLastName(), GenerateSSN(), RandDouble(), (decimal)RandDouble()));
|
||||
break;
|
||||
case 2: // Salary
|
||||
empn.Add(new SalariedEmployee(GenerateFirstName(), GenerateLastName(), GenerateSSN(), (decimal)RandDouble()));
|
||||
break;
|
||||
default: // Hourly
|
||||
empn.Add(new HourlyEmployee(GenerateFirstName(), GenerateLastName(), GenerateSSN(), (decimal)RandDouble(), RandDouble()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Loop through the new array list.
|
||||
for (int i = 0; i < empn.Count; i++ )
|
||||
{
|
||||
Console.WriteLine("\n================Employee #: {0}================", (i + 1)); // spit out the squence number
|
||||
Console.WriteLine(empn[i]); // tostring method. so much easier.
|
||||
// remind me to always override the tostring() method.
|
||||
}
|
||||
|
||||
// courtesy line and direction.
|
||||
Console.WriteLine("----------------------------------------\nPress ENTER to continue");
|
||||
// let's keep the console from closing.
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{FFA33A1C-42BF-4496-A1B4-1A00294803D4}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Project2</RootNamespace>
|
||||
<AssemblyName>Project2</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BasePlusCommissionEmployee.cs" />
|
||||
<Compile Include="CommissionEmployee.cs" />
|
||||
<Compile Include="Employee.cs" />
|
||||
<Compile Include="HourlyEmployee.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RandomThings.cs" />
|
||||
<Compile Include="SalariedEmployee.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<None Include="ARCHITECTURE.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Project2")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Coleman University")]
|
||||
[assembly: AssemblyProduct("Project2")]
|
||||
[assembly: AssemblyCopyright("Copyright © Coleman University 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("49380830-1af5-4d23-9477-5145a019c8bf")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,76 @@
|
||||
/*****************************************************************************
|
||||
* Project: 2 - Payroll *
|
||||
* Description: Implement a payroll system using abstract classes *
|
||||
* Author: Amrit Panesar - 77260 *
|
||||
* License: Public Domain *
|
||||
* File description: Houses the random functions found in the file Program.cs *
|
||||
* The functions RandNumber(), RandDouble(), GenerateFirstName(), and *
|
||||
* GenerateLastName() can all be found in this file. *
|
||||
* For further description please see ARCHITECTURE.txt *
|
||||
*****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Project2
|
||||
{
|
||||
public partial class Program
|
||||
{
|
||||
// generate a random number from 0 to the maximum value an integer can hold. Positive values.
|
||||
public static int RandNumber(int Low = 0, int High = int.MaxValue)
|
||||
{
|
||||
Random rndNum = new Random(int.Parse(Guid.NewGuid().ToString().Substring(0, 8), NumberStyles.HexNumber));
|
||||
int rnd = rndNum.Next(Low, High);
|
||||
return rnd;
|
||||
}
|
||||
|
||||
// generate a random floating point double. positive values.
|
||||
public static double RandDouble()
|
||||
{
|
||||
Random rndNum = new Random(int.Parse(Guid.NewGuid().ToString().Substring(0, 8), NumberStyles.HexNumber));
|
||||
double rnd = rndNum.NextDouble() * 28;
|
||||
return rnd;
|
||||
}
|
||||
|
||||
// grab a random firstname from this string array.
|
||||
public static string GenerateFirstName()
|
||||
{
|
||||
string[] firstnames = { "Librada","Jeanne","Krishna","Roni","Kisha","Edison","Freda","Jed","Lorraine","Nelda","Corine","Lien","Daisy","Gita","Suzy","Gwyneth","Krysta","Erinn","Samual","Barney","Rosia","Malik","Franchesca","Cherryl","Ricardo","Inga","Lesley","Kory","Jaunita","Lacey","Chelsie","Kera","Isaac","Aracely","Delmy","Maggie","Rolland","Estela","Otha","Arturo","Devona",
|
||||
"Wilton","Karey","Hillary","Jared","Tiffiny","Boris","Flavia","Rivka","Casimira","Adria","Odette","Wilbert","Xuan","Allyson","Rosendo","Elijah","Tad","Malisa","Kayleen","Jone","Reina","Laraine","Len","Leora","Fred","Sydney","Sona","Thuy","Sage","Sixta","Joseph","Chantell","Kiesha","Kacie","Maryellen","Fidelia","Anastasia","Stephaine","Johanne","Charlesetta",
|
||||
"Crista","Jarod","Sherrell","Sebrina","Juliet","Charise","Candida","Jonnie","Daine","Jong","Maida","Danilo","Jeneva","Margret","Domenic","Luanna","Nana","Salley","Hipolito","Sanjuanita","Giuseppina","Domonique","Shayla","Melva","Leora","Ashleigh","Ruben","Delbert","Evelina","Jeanie","Margarett","Marcie","Assunta","Latoria","Jodie","Kenisha","Anamaria","Shirleen",
|
||||
"Ashton","Yan","Fanny","Vanita","Marlyn","Maryland","Shandi","Adolph","Amina","Manuel","Dawne","Cristine","Alberto","Tabetha","Frida","Awilda","Louann","Karly","Dede","Kristina","Sue","Elissa","Jamika","Margret","Ninfa","Louisa","Vinita","Gigi","Quinn","Maricruz","Jeanmarie","Niesha","Marquita","Hertha","Shawnna","Jetta","Kristel","Shaunta","Kiyoko","Alana","Eduardo",
|
||||
"Trish","Willa","Darline","Ching","Rosenda","Rufus","Kraig","Tia","Keely","Markita","Georgann","Nicola","Judy","Ignacio","Shantay","Cicely","Astrid","Ladawn","Nia","Babara","Deidre","Geoffrey","Leilani","Lamont","Delphine","Harrison","Anjanette","Zona","Carmen","Hui","Luvenia","Leeann","Marybelle","Shanon","Nicky","Carlene","Laquanda","Aldo","Larisa","Tony",
|
||||
"Madeleine","Garnett","Shae","Shemika","Erich","Celestina","Foster","Kaitlyn","Mariela","Noe","Rafael","Jesusa","Cole","Lettie","Sherill","Trey","Marg","Shaunda","Randell","Piedad","Marjorie","Verena","Elicia","Mika","Colette","Corene","Veronika","Jerrie","Rosie","Georgene","Serafina","Sherman","Susannah","Annamae","Michell","Kelsey","Rosario","Carolina","Jeanie",
|
||||
"Lyndia","Ora","Herta","Santa","Erline","Karmen","Griselda","Maud","Linnie","Nicholle","Mistie","Jordan"};
|
||||
// use the positive random number function above, mod'd by the length to grab a random value
|
||||
return (firstnames[RandNumber() % firstnames.Length]);
|
||||
}
|
||||
|
||||
// grab a random lastname from this string array.
|
||||
public static string GenerateLastName()
|
||||
{
|
||||
string[] lastnames = { "Ives","Dole","Bechtel","Gilfillan","Fahey","Montrose","Harvin","Arvizo","Letarte","Reidhead","Ahlstrom","Hyneman","Reynoso","Douglass","Prato","Mccutchen","Mohl","Sperry","Greb","Cabell","Laramore","Fujiwara","Arpin","Brumfield","Fortin","Markell","Ballengee","Sanluis","Trickey","Haake","Zirkle","Gaines","Ahern","Lafond","Jude","Robie","Runion","Runyan","Futrell",
|
||||
"Rather","Kinloch","Rugg","Senecal","Vanhook","Vallance","Stillwell","Haldeman","Thrush","Shomo","Valerius","Cazares","Townley","Rakestraw","Agar","Meinecke","Coll","Redick","Saint","Spight","Mcnaught","Gayman","Yerger","Rivero","Fabela","Wilhoite","Middlebrooks","Jefferys","Massie","Reichel","Lobb","Ristow","Rucks","Heckard","Hosmer","Dingess","Schamber","Hesson",
|
||||
"Torbett","Goldschmidt","Hayter","Shew","Ugalde","Vicknair","Danks","Tate","Delorme","Ormand","Laughton","Wilkerson","Dickson","Mulvey","Junkin","Camacho","Barsh","Recker","Farnsworth","Gary","Drees","Knoles","Satter","Battin","Costa","Matsumura","Shears","Devinney","Macken","Garrett","Doney","Fulmer","Hoss","Loll","Tanner","Podesta","Asaro","Morningstar","Hilyard",
|
||||
"Nehls","Fonseca","Eller","Wilkinson","Lamarca","Soliz","Westervelt","Carlino","Kunkle","Loucks","Jansson","Cothren","Darlington","Zahm","Pinegar","Emerick","Tall","Eveland","Umstead","Davisson","Batz","Plata","Ryberg","Beane","Koening","Putz","Daughtrey","Sinha","Gerdes","Arno","Lorch","Shehan","Chenard","Holloway","Castleberry","Bowlin","Battin","Donovan","Calton",
|
||||
"Huot","Mcmurtrie","Delapp","Lankford","Biel","Kin","Caceres","Ormand","Streicher","Kimbrel","Cornish","Barahona","Southern","Stuart","Stoke","Scharff","Hartwell","Gildersleeve","Tedrick","Rex","Chaudhry","Wetzel","Desai","Ensey","Escobedo","Matranga","Falzone","Ritzman","Marchant","Babin","Friedt","Shoup","Gunder","Seim","Shadrick","Riggs","Moret","Howes","Steenbergen",
|
||||
"Rodriques","Dries","Jefferson","Hulbert","Menendez","Ellington","Housand","Whitwell","Rearick","Wagnon","Schmitmeyer","Barhorst","Rosenfield","Summerville","Matus","Marrow","Kind","Searfoss","Denn","Appling","Grim","Huffer","Kellen","Roscoe","Garofalo","Simeone","Goucher","Parkhurst","Tarpey","Bassett","Ortman","Segundo","Mattson","Pullum","Kriner","Smiddy","Cohrs",
|
||||
"Loring","Strebel","Mcnemar","Grossi","Raby","Dubray","Capra","Wittrock","Fazzino","Bedard","Sera","Lisk","Heldt","Barefoot","Heimbach","Hover","Guthrie","Hartigan","Noyes","Jarrard"};
|
||||
// use the positive random number function above, mod'd by the length to grab a random value
|
||||
return (lastnames[RandNumber() % lastnames.Length]);
|
||||
}
|
||||
|
||||
// make a random social security number
|
||||
public static string GenerateSSN()
|
||||
{
|
||||
int G1 = RandNumber(1, 1000);
|
||||
int G2 = RandNumber(1, 100);
|
||||
int G3 = RandNumber(1, 10000);
|
||||
// use the string.format and tostring methods to numerically pad each tuple of a social security number
|
||||
return String.Format("{0}-{1}-{2}", G1.ToString("D3"), G2.ToString("D2"), G3.ToString("D4"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/*****************************************************************************
|
||||
* Project: 2 - Payroll *
|
||||
* Description: Implement a payroll system using abstract classes *
|
||||
* Author: Amrit Panesar - 77260 *
|
||||
* License: Public Domain *
|
||||
* File description: Contains the member variables and functions for salaried *
|
||||
* employees. *
|
||||
* For further description please see ARCHITECTURE.txt *
|
||||
*****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Project2
|
||||
{
|
||||
public class SalariedEmployee : Employee
|
||||
{
|
||||
// main constructor for the salaried employee
|
||||
public SalariedEmployee(string FirstName, string LastName, string SSN, decimal weeklysal) : base(FirstName, LastName, SSN)
|
||||
{
|
||||
WeeklySalary = weeklysal;
|
||||
}
|
||||
public decimal WeeklySalary { get; set; }
|
||||
|
||||
public override decimal Earnings()
|
||||
{
|
||||
// a salaried employee's earnings are his/her weekly salary.
|
||||
return WeeklySalary;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
// the standard employee tostring, weekly salary, and earnings
|
||||
return String.Format("salaried {0}\nweekly salary: {1}\nearnings: {2}\n",base.ToString(),WeeklySalary.ToString("C"),Earnings().ToString("C"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user