Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C# make these updates to the following code. *Update the Employee class* -Update a new field, telephone number - Include error checking to match

Using C# make these updates to the following code.

*Update the Employee class*

-Update a new field, telephone number

- Include error checking to match that a telephone number hasbeen entered.

This will require a regex expression to look for the followingpatterns:

999-999-9999, 999 999-9999, (999) 999-9999, 999 999 9999

- If not found, throw an exception with the following stringmessage Error:10 Phone number is not in the proper format

Then

Add two more properties, one for HealthPlan(0-None, 1-Single,2-Married, 3-Family) and one for UnionMember (true/false).

Throw an exception if someone tries to set the field to someother integer number. The string mesage will be Error:30 Invalid HealthPlan code.

Set the default values in the constructor to _healthPlan = 0 and_unionMemb = false.

Employee class

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

namespace Program10_1
{
class Employee
{
private string _name;
private int _number;

public Employee()
{
}

public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
}

public int Number
{
get
{
return _number;
}
set
{
_number = value;
}
}
}
}

image text in transcribed

Employee Name: Employee Number: Shift Number: Hourly Pay Rate: $ O day (1) Onight (2) Display

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

15. What are the four steps in taking a physical inventory?

Answered: 1 week ago