SHARE
TWEET

Untitled

a guest Dec 13th, 2018 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Q3to5
  8. {
  9.  
  10.     /*
  11.      * Create a person Class that cannot be instatiated
  12.      * ID, First Name, Last name as public fields
  13.      * Has a GetInfo() method in the person class that returns a string,  lastName "," firstName
  14.      */
  15.  
  16.  
  17.     public abstract partial class Person
  18.     {
  19.         public string ID { get; set;}
  20.         public string firstName, lastName;
  21.  
  22.         public Person(string I, string F, string L)
  23.         {
  24.  
  25.            ID = I;  firstName =F; lastName = L;
  26.  
  27.         }
  28.  
  29.         public virtual string GetInfo()
  30.         {
  31.             return ID + " " +  lastName + "," + firstName  ;  
  32.  
  33.         }
  34.  
  35.  
  36.         /*
  37.          * Create Professor Subclass, it includes "Title"
  38.  
  39.          create Staff subclass , it should include "Position"
  40.  
  41.          both include Virtual Provide GetInfo() ~ which returns string ID, name,  Position (title for prof)
  42.          For Professors  a colon before Title - > eg : Title
  43.          * */
  44.    
  45.     }
  46.  
  47.     public partial class Professor : Person
  48.        
  49.     {
  50.         string title;
  51.  
  52.         public Professor(string I, string F, string L, string T) : base (I, F, L)
  53.         {
  54.            
  55.             title = T;
  56.         }
  57.  
  58.         public override string GetInfo()
  59.         {
  60.             return base.GetInfo() + " : " + title;
  61.         }
  62.  
  63.  
  64.     }
  65.  
  66.  
  67.     public partial class Staff : Person
  68.  
  69.     {
  70.         string position;
  71.  
  72.         public Staff(string I, string F, string L, string P) : base(I, F, L)
  73.         {
  74.            position = P;
  75.         }
  76.  
  77.         public override string GetInfo()
  78.         {
  79.             return base.GetInfo() + " , " + position;
  80.         }
  81.  
  82.     }
  83.  
  84.  
  85.     //Create two Staff and Professor
  86.  
  87.  
  88.    
  89.  
  90. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top