i need help solving the error coding below, i use programing language c# please provide steps of
Fantastic news! We've Found the answer you've been seeking!
Question:
i need help solving the error coding below, i use programing language c# please provide steps of how you fixed these problems, showed how you fixed them, and making sure the code runs fine thank you, heres the error below
heres my completed code so far
Step 2: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Lab4 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { // create a new labourer object and assign it to a variable Labourer l1 = new Labourer(); // have the object speak and move l1.Speak(outputControl); l1.Move(outputControl); // print out how many labourers have been created outputControl.Text += "Total labourers created: " + Labourer.WorkerCount + Environment.NewLine; // create another labourer object and assign it to a new variable Labourer l2 = new Labourer(); // have the object speak and move l2.Speak(outputControl); l2.Move(outputControl); // print out how many labourers have been created outputControl.Text += "Total labourers created: " + Labourer.WorkerCount + Environment.NewLine; // create a new labourer object and assign it to the first variable created l1 = new Labourer(); // have the object speak and move l1.Speak(outputControl); l1.Move(outputControl); // print out how many labourers have been created outputControl.Text += "Total labourers created: " + Labourer.WorkerCount + Environment.NewLine; // create an object of type apprentice Apprentice a1 = new Apprentice("John"); // have it speak and move a1.Speak(outputControl); a1.Move(outputControl); // print out how many labourers and apprentices have been created outputControl.Text += "Total labourers created: " + (Labourer.WorkerCount + Apprentice.ApprenticeCount) + Environment.NewLine; } } public class Labourer { private static int labourerCount; public Labourer() { labourerCount++; } public static int WorkerCount { get { return labourerCount; } } public void Speak(Control outputControl) { outputControl.Text += "mumble mumble" + Environment.NewLine; } public void Move(Control outputControl) { outputControl.Text += "location changed" + Environment.NewLine; } } public class Apprentice : Labourer { private static int apprenticeCount; protected string workerName; public Apprentice(string name) { workerName = name; apprenticeCount++; } public static int ApprenticeCount { get { return apprenticeCount; } } public string Name { get { return workerName; } } public new void Speak(Control outputControl) { outputControl.Text += "I am an apprentice and my name is " + workerName + Environment.NewLine; } } }
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date: