Please code using C Review Figure 124 below Create a class c
Solution
Find the answer below:
========================================================================
using System.IO;
 using System;
public abstract class Employee{
     public string FirstName {get;private set;}
      public string LastName {get;private set;}
       public string SocialSecurityNumber {get;private set;}
     public Employee(string first ,string last,string ssn){
         // Console.WriteLine(\"In Employee Constructore ...\");
         FirstName = first;
         LastName = last;
         SocialSecurityNumber = ssn;
     }
     public override string ToString(){
         return string.Format(\"{0} {1} \  social security number {2}\",FirstName,LastName,SocialSecurityNumber);
     }
   
     public abstract decimal Earnings();
   
 }
 class Volunteer : Employee
 {
     public string CompanytName {get;private set;}
     public decimal Hours {get;private set;}
     public Volunteer(string first ,string last,string ssn,string cmpn,decimal hr):base(first,last,ssn){
          //Console.WriteLine(\"In Volunteer Constructore ...\");
       
         CompanytName = cmpn;
         Hours = hr;
     }
    public override string ToString(){
         return string.Format(\"{0} {1} \ social security number : {2}\ Company Name : {3}\ Hours : {4}\",FirstName,LastName,SocialSecurityNumber,CompanytName,Hours);
 
     }
     public override decimal Earnings(){
         Console.WriteLine(\"In Earnings...\");
         return (((3*75*Hours)/300));
     }
 }
 class Test{
   
     static void Main()
     {
         string firstname,lastname,socialsecurity_num,company;
         decimal hours;
         Volunteer volunteer1 = null;
         Volunteer volunteer2 = null;
         for(int i=1;i<=2;i=i+1)
         {
         Console.WriteLine(\"Enter FirstName\");
         firstname = Console.ReadLine();
         Console.WriteLine(\"Enter LastName\");
         lastname = Console.ReadLine();
         Console.WriteLine(\"Enter socila security number\");
         socialsecurity_num = Console.ReadLine();
         Console.WriteLine(\"Enter company name\");
         company = Console.ReadLine();
         Console.WriteLine(\"Enter hours\");
         Decimal.TryParse(Console.ReadLine(), out hours);
         if(i==1) volunteer1 = new Volunteer(firstname,lastname,socialsecurity_num,company,hours);
          if(i==2) volunteer2 = new Volunteer(firstname,lastname,socialsecurity_num,company,hours);
          }
   
     Console.WriteLine(volunteer1 +\" Earnings :\"+ volunteer1. Earnings());
     Console.WriteLine(volunteer2 +\" Earnings :\"+ volunteer2. Earnings());
     }
 }
 =======================================================================
INPUT:
Enter FirstName
xyz
Enter LastName
abc
Enter socila security number
hello
Enter company name
defgh
Enter hours
12
Enter FirstName
hgi
Enter LastName
jkl
Enter socila security number
howareyou
Enter company name
bjjs
Enter hours
20
=======================================================================
OUTPUT:
In Earnings...
xyz abc
social security number : hello
Company Name : defgh
Hours : 12 Earnings :9
In Earnings...
hgi jkl
social security number : howareyou
Company Name : bjjs
Hours : 20 Earnings :15



