Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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; } } }
CS0103 The name 'outputControl' does not exist in the current context CS0103 The name 'outputControl' does not exist in the current context CS0103 The name 'outputControl' does not exist in the current context CS0103 The name 'outputControl' does not exist in the current context CS0103 The name 'outputControl' does not exist in the current context CS0103 The name 'outputControl' does not exist in the current context CS0103 The name 'outputControl' does not exist in the current context X CS0103 The name 'outputControl' does not exist in the current context CS0103 The name 'outputControl' does not exist in the current context CS0103 The name 'outputControl' does not exist in the current context CS0103 The name 'outnutControl does not exist in the current context Lab4 Lab4 Lab4 Lab4 Lab4 Lab4 Lab4 Lab4 Lab4 Lab4 Lab Form1.cs Form1.cs Form1.cs Form1.cs Form1.cs Form1.cs Form1.cs Form1.cs Form1.cs Form1.cs Form1 c 26 Active 28 Active 33 Active 34 Active 36 Active 41 Active 42 Active 44 Active 49 Active 50 Active 52 Active
Step by Step Solution
★★★★★
3.32 Rating (155 Votes )
There are 3 Steps involved in it
Step: 1
1 Incorrect namespaces The using statements at the beginning of the code contain typos and incorrect ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started