This Is my assignment, I am having trouble getting my class to work with main for, can someone please help me? This is due on Tuesday and I have been hitting a brick wall in every approach I have tried. All my class and my forms are posted. Please help me I am totally lost and frustrated
- Employee and ProductionWorker Classes
Create an Employee class that has properties for the following data:
- Employee name
- Employee number
Next, create a class named ProductionWorker that is derived from the Employee class.
The ProductionWorker class should have properties to hold the following data:
- Shift number (an integer, such as 1, 2, or 3)
- Hourly pay rate The workday is divided into two shifts: day and night.
The Shift property will hold an integer value representing the shift that the employee works. The day shift is shift 1 and the night shift is shift 2.
Create an application that creates an object of the ProductionWorker class and lets the user enter data for each of the object’s properties. Retrieve the object’s properties and display their values.
This is my employee reference chart to store their names and I.D numbers. I am getting no compiling errors on this class, however I am not sure if I am doing this correctly because in my main I get a compiling error.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Employee_References
{
class Roster
{
// Field for name, ID, dept, and position
private const int NAMES = 100;
private static string [] employee = new string [NAMES];
private const int NUMBER = 100;
private static int [] id = new int [NUMBER];
private int total = 0;
public void Employee()
{
total = 0;
}
// This will recieve input from my main
public static void employeeName (string [] xArray)
{
for (int index = 0; index < xArray.Length; index++)
{
xArray[index] = employee[NAMES];
}
}
// This will recieve input from my main
public static void idNumber ( int [] zArray)
{
for (int index = 0; index < zArray.Length; index++)
{
zArray[index] = id[NUMBER];
}
}
}
}
This will be my next class that is derived from my first class. This class is suppose to store the shift numbers 1 through for 4, and an hourly wage setter for a Day and Night Shift. I am getting one compiling error in this class that says " The left-hand side of an assignment must be a variable, property or indexer" I am not sure What it is telling me, can someone please explain what it is trying to tell me.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Employee_References
{
class References : Roster
{
// Field for name, ID, dept, and position
private int shift;
private static const double PAYRATEDAY = 12.75;
private static const double PAYRATENIGHT = 15.75;
public void Employee()
{
}
// This will recieve input from my main
public int shifts
{
set {shift = value;} // this set the recieve value of name one and set it to name1
get {return shift; } //this will get name1 and send it to my main.
}
// This will recieve input from my main
public double payrate1
{
set { PAYRATEDAY = value; } // ERROR!!The left-hand side of an assignment must be a variable, property or indexer
get { return PAYRATEDAY; }
}
// This will recieve input from my main
public double payrate2
{
get { return PAYRATENIGHT; } // ERROR!!The left-hand side of an assignment must be a variable, property or indexer
set { PAYRATENIGHT = value; }
}
}
This is my Main, I am trying to assign input values that are going to be entered in this form, and pass them into my "Roster" class That has an array of 100. How ever I keep getting a compiling error that says " Cannot assign to 'employeeName' because it is a 'method group". I am not sure What It is telling me can some one explain this to me, and give me some pointer on how to do this.
using System;
using System.Windows.Forms;
namespace Employee_References
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Roster Chart = new Roster();
Chart.employeeName = name.Text; // Error **Cannot assign to 'employeeName' because it is a 'method group**".
}
}
}