public static void Main()
Movie.PrintAvengersInfo();
Movie movie1 = new Movie("After", 2019, 14000000, 2.8, Genre.Drama, new Director("Jenny Gage", 52, "American"));
Movie movie2 = new Movie("The maze runner", Genre.Action, new Director("Wes Ball", 40));
private string title = null;
private int yearOfPremiere = 0;
private double budget = 0;
private double rating = 0;
private Director director;
private static Movie TheAvengers = new Movie("Avengers", 2012, 220000000, 5, Genre.Adventure, new Director("Joss Whedon", 56, "American"));
public Movie(string title, Genre genre, Director director)
this.director = director;
public Movie(string title, int yearOfPremiere, double budget, double rating)
this.YearOfPremiere = yearOfPremiere;
public Movie(string title, int yearOfPremiere, double budget, double rating, Genre genre, Director director)
this.YearOfPremiere = yearOfPremiere;
this.Director = director;
get { return this.title; }
if(string.IsNullOrWhiteSpace(value))
throw new ArgumentException("Invalid Argument: The title can't be null or white space.");
public int YearOfPremiere
get { return this.yearOfPremiere; }
throw new ArgumentException("Invalid Argument: The year of premiere shouldn't be a negative number.");
this.yearOfPremiere = value;
get { return this.budget; }
throw new ArgumentException("Invalid Argument: The budget shouldn't be a negative number.");
get { return this.rating; }
throw new ArgumentException("Invalid Argument: The rating shouldn't be a negative number.");
get { return this.genre; }
if (value == Genre.Unknown)
throw new ArgumentException("The genre shouldn't be 'Unknown'.");
get { return this.director; }
throw new ArgumentException("Director shouldn't be null.");
public static void PrintAvengersInfo()
Console.WriteLine("-----------Info for Avengers movie----------");
Console.WriteLine("Title: {0} \nYear of premier: {1} \nBudget: {2}$ \nRating: {3} \nGenre: {4}",
Movie.TheAvengers.Title, Movie.TheAvengers.YearOfPremiere, Movie.TheAvengers.Budget,
Movie.TheAvengers.Rating, Movie.TheAvengers.Genre);
Console.WriteLine("\n-----Info for the director of Avengers------\n");
Console.WriteLine(Movie.TheAvengers.Director.GetDirectorInfo());
public void PrintMovieInfo()
Console.WriteLine("\n------------Info for {0} movie------------\n", this.Title);
Console.WriteLine("Title: {0} \nYear of premier: {1} \nBudget: {2}$ \nRating: {3} \nGenre: {4}",
this.Title, this.YearOfPremiere, this.Budget, this.Rating, this.Genre);
Console.WriteLine("\n------Info for the director of {0}-------\n", this.Title);
Console.WriteLine(this.Director.GetDirectorInfo());
private string directorName = null;
private string nationality = null;
public Director(string directorName, int age)
this.DirectorName = directorName;
public Director(string directorName, int age, string nationality)
this.DirectorName = directorName;
this.Nationality = nationality;
public string DirectorName
get { return this.directorName; }
if(string.IsNullOrWhiteSpace(value))
throw new ArgumentException("Invalid Argument: The director name can't be null or white space.");
this.directorName = value;
throw new ArgumentException("Invalid Argument: The age shouldn't be a negative number.");
public string Nationality
get { return this.nationality; }
if(string.IsNullOrWhiteSpace(value))
throw new ArgumentException("Invalid Argument: The nationality can't be null or white space.");
this.nationality = value;
public string GetDirectorInfo()
string result = string.Format("Name: {0} \nAge: {1} \nNationality: {2}", this.DirectorName, this.Age, this.Nationality);