static void Main(string[] args) { HomeStead home = new HomeStead("Zuma", "Wierda", "Gauteng", "ZA"); Nkandla nkandla = new Nkandla("Zuma", "Wierda", "Gauteng", "ZA"); string temp = "HomeStead:" + " Name { Zuma } District { Wierda } Province { Gauteng } Country { ZA }"; if (temp.Equals(home.ToString())) { Console.WriteLine("HomeStead initiated correctly done"); } Politician JacobZuma = new Politician("Jacob Zuma", 43, Gender.MALE, PersonType.President, PartyType.ANC); Politician HelenZille = new Politician("Hellen Zille", 50, Gender.FEMALE, PersonType.Politician, PartyType.DA); Politician JuliusMalema = new Politician("Julius Malema", 38, Gender.MALE, PersonType.Politician, PartyType.EFF); Lawer BarryRoux = new Lawer("Barry Roux", 55, Gender.MALE, PersonType.Lawyer, PartyType.ANC); Architect GregWright = new Architect("Greg Wright", 62, Gender.MALE, PersonType.Architect, PartyType.ANC); Console.WriteLine(JacobZuma.ToString()); Console.WriteLine(HelenZille.ToString()); Console.WriteLine(JuliusMalema.ToString()); Console.WriteLine(BarryRoux.ToString()); Console.WriteLine(GregWright.ToString()); home.accept(HelenZille); home.accept(JuliusMalema); home.accept(JacobZuma); Console.Read(); }
public void AcceptUnwelcomeTest() { Politician hz = new Politician(); hz.Name = "Jacob Zuma"; hz.Party = Party.DA; _nkandla.Accept(hz); }
public void AcceptWelcomeTest() { Politician jz = new Politician(); jz.Name = "Jacob Zuma"; jz.Party = Party.ANC; _nkandla.Accept(jz); }
static void Main(string[] args) { HomeStead home = new HomeStead("Zuma", "Wierda", "Gauteng", "ZA"); Nkandla nkandla = new Nkandla("Zuma", "Wierda", "Gauteng", "ZA"); //Testing string temp = "HomeStead:" + " Name [Zuma] District [Wierda] Province [Gauteng] Country [ZA]"; if (temp.Equals(home.ToString())) { Console.WriteLine("HomeStead initiated correct"); } ChickenRun chickens = new ChickenRun(); chickens.NumerOfChickens = 50; SwimmingPool firePool = new SwimmingPool(); firePool.Height = 100; firePool.Width = 75; Amphitheatre amphi = new Amphitheatre(); amphi.NumberOfSeats = 5000; nkandla.ChickenRun = chickens; nkandla.SwimmingPool = firePool; nkandla.Amphitheatre = amphi; //Testing the properties of Nkandla Console.WriteLine("Nkandla ChickenRun: NumberOfChickens = " + chickens.NumerOfChickens); Console.WriteLine("Nkandla SwimmingPool: Width = " + firePool.Width + " Height: " + firePool.Height); Console.WriteLine("Nkandla Amphitheatre: NumberOfSeats = " + amphi.NumberOfSeats); Politician JacobZuma = new Politician("Jacob Zuma", 43, Gender.MALE, PersonType.President, PartyType.ANC); Politician HelenZille = new Politician("Hellen Zille", 50, Gender.FEMALE, PersonType.Politician, PartyType.DA); Politician JuliusMalema = new Politician("Julius Malema", 38, Gender.MALE, PersonType.Politician, PartyType.EFF); Lawer BarryRoux = new Lawer("Barry Roux", 55, Gender.MALE, PersonType.Lawyer, PartyType.ANC); Architect GregWright = new Architect("Greg Wright", 62, Gender.MALE, PersonType.Architect, PartyType.ANC); //Output Console.WriteLine(JacobZuma.ToString()); Console.WriteLine(HelenZille.ToString()); Console.WriteLine(JuliusMalema.ToString()); Console.WriteLine(BarryRoux.ToString()); Console.WriteLine(GregWright.ToString()); home.accept(HelenZille); home.accept(JuliusMalema); home.accept(JacobZuma); Console.Read(); }
public string accept(Visitor person) { string returnStr; if (person is Politician) { Politician pol = (Politician)person; if (pol.getParty() == "ANC") { return(pol.visit(this)); } else { throw new VisitorNotAllowedException("Visit method could not be called, because this visitor may not enter " + name); } } else { throw new VisitorNotAllowedException("Visit method could not be called, because this person is not a visitor"); } }
static void Main(string[] args) { Politician helen = new Politician("Helen Zille", 50, Gender.Female, "DA"); Politician julius = new Politician("Julius Malema", 55, Gender.Male, "EFF"); Politician jacob = new Politician("Jacob Zuma", 70, Gender.Male, "ANC"); HomeStead nkandla = new Nkandla("Nkandla", "uThungulu", "KwaZulu-Natal", "South Africa"); try { nkandla.accept(helen); } catch (Exception e) { Console.WriteLine(e.Message); } try { nkandla.accept(jacob); } catch (Exception e) { Console.WriteLine(e.Message); } try { nkandla.accept(julius); } catch (Exception e) { Console.WriteLine(e.Message); } Console.ReadLine(); }
public void initilialise() { _politician = new Politician(); _politician.Name = "A Jerk"; }