i need help solving the error coding below, i use programing language c# please provide steps of
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 original code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace Lab4
{
internal static class Program
{
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
public class Labourer
{
private static int labourerCount = 0;
public Labourer()
{
labourerCount++;
}
public int WorkerCount
{
get
{
return labourerCount;
}
}
public void Speak()
{
MyTextBox.Text += "mumble mumble" + Environment.NewLine;
}
public void Move()
{
MyTextBox.Text += "location changed" + Environment.NewLine;
}
}
public class Apprentice : Labourer
{
// Static field to record how many apprentices have been created
private static int apprenticeCount = 0;
// Protected field for the worker name
protected string workerName;
// Property to display the apprentice count
public int ApprenticeCount
{
get
{
return apprenticeCount;
}
}
// Read-only property to return the worker name
public string Name
{
get
{
return workerName;
}
}
// Constructor to take in a name string and set the name backing field
public Apprentice(string name)
{
workerName = name;
// Increment the apprentice counter
apprenticeCount++;
}
}
public class Journeyman : Apprentice
{
// Constructor to take in a name string and pass it to the base class
public Journeyman(string name) : base(name)
{
}
// Method to output '
public void FixItAll()
{
// Write to the output control
MyTextBox.Text += Name + " fixes all the mistakes with their magic hammer" + Environment.NewLine;
}
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
myTextbox.Text += "message";
myTextbox.Text += Environment.NewLine;
}
private void button1_Click(object sender, EventArgs e)
{
// Create a labourer object and assign it to a variable
Labourer labourer1 = new Labourer();
// Have the object speak
labourer1.Speak();
// Have the object move
labourer1.Move();
// Print out how many labourers have been created
MyTextBox.Text += "Number of labourers created: " + labourer1.WorkerCount.ToString() + Environment.NewLine;
// Create another labourer object (in a new variable)
Labourer labourer2 = new Labourer();
// Have the object speak
labourer2.Speak();
// Have the object move
labourer2.Move();
// Print out how many labourers have been created
MyTextBox.Text += "Number of labourers created: " + labourer2.WorkerCount.ToString() + Environment.NewLine;
// Create a new labourer object and assign it to the first variable created (should only have 2 variables of type labourer)
Labourer labourer3 = labourer1;
// Have the object speak
labourer3.Speak();
// Have the object move
labourer3.Move();
// Print out how many labourers have been created
MyTextBox.Text += "Number of labourers created: " + labourer3.WorkerCount.ToString() + Environment.NewLine;
Apprentice apprentice = new Apprentice("Bob");
// Have it speak
apprentice.Speak();
// Have it move
apprentice.Move();
// Print out how many LABOURERS have been created
MyTextBox.Text += "Number of labourers created: " + apprentice.WorkerCount.ToString() + Environment.NewLine;
// Print out how many apprentices have been created
MyTextBox.Text += "Number of apprentices created: " + apprentice.ApprenticeCount.ToString() + Environment.NewLine;
// Create an object of type journeyman
Journeyman journeyman = new Journeyman("John");
// Have it move
journeyman.Move();
// Have it speak
journeyman.Speak();
// Have it fix it all
journeyman.FixItAll();
// Display its name
MyTextBox.Text += "Journeyman's name: " + journeyman.Name + Environment.NewLine;
// Print out how many LABOURERS have been created
MyTextBox.Text += "Number of labourers created: " + journeyman.WorkerCount.ToString() + Environment.NewLine;
// Print out how many apprentices have been created
MyTextBox.Text += "Number of apprentices created: " + journeyman.ApprenticeCount.ToString() + Environment.NewLine;
// Create another journeyman
Journeyman journeyman2 = new Journeyman("Mary");
// Have it move
journeyman2.Move();
// Have it speak
journeyman2.Speak();
// Have it fix it all
journeyman2.FixItAll();
// Display its name
MyTextBox.Text += "Journeyman's name: " + journeyman2.Name + Environment.NewLine;
// Print out how many LABOURERS have been created
MyTextBox.Text += "Number of labourers created: " + journeyman2.WorkerCount.ToString() + Environment.NewLine;
// Print out how many apprentices have been created
MyTextBox.Text += "Number of apprentices created: " + journeyman2.ApprenticeCount.ToString() + Environment.NewLine;
}
}
}
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill