Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me DEBUG this code below with explanation: Thanks. using System; pub

ID: 3619055 • Letter: P

Question


Please help me DEBUG this code below with explanation: Thanks. using System;
public class CreateEmployeeWithAutoImplementedProperty
{
public static void Main()
{
  Employee aWorker = new Employee();
  aWorker.IdNumber = 3872;
  aWorker.Salary = 22.11;
  Console.WriteLine("Employee #{0} makes {1}",aWorker.idNumber, aWorker.salary.ToString("C"));
}
}
public class Employee
{
// Properties
public int idNumber {get; set;}
public double salary {get; set;}
}
Please help me DEBUG this code below with explanation: Thanks. using System;
public class CreateEmployeeWithAutoImplementedProperty
{
public static void Main()
{
  Employee aWorker = new Employee();
  aWorker.IdNumber = 3872;
  aWorker.Salary = 22.11;
  Console.WriteLine("Employee #{0} makes {1}",aWorker.idNumber, aWorker.salary.ToString("C"));
}
}
public class Employee
{
// Properties
public int idNumber {get; set;}
public double salary {get; set;}
}

Explanation / Answer

Errors are marked in red color. //Code after fixing the bugs. using System; namespace Employees {     classCreateEmployeeWithAutoImplementedProperty     {         public static voidMain(string[] arg)         {            //Creating Object of Employ using Employ Class            Employee aWorker = new Employee();            //Assigning the id and Salary to the aWorker object. internally itwill make use of setter and getter properties            aWorker.idNumber = 3872;            aWorker.salary = 22.11;            //Printitn the employ details            //{0} refers the first variable in the variables list and {1}refers the second one and so.. on            //You can also try            //Console.WriteLine("Employee #"+ aWorker.idNumber +" makes "+aWorker.salary.ToString("C"));            Console.WriteLine("Employee #{0} makes {1}", aWorker.idNumber,aWorker.salary.ToString("C"));            Console.Read();         }     } } //Employ Class using System; namespace Employees {     public class Employee     {         //Properties or setters andgetters         public int idNumber {get; set; }         public double salary {get; set; }     } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote