Facebook
From Colossal Dormouse, 2 Years ago, written in C#.
Embed
Download Paste or View Raw
Hits: 58
  1. using System;
  2. using System.Collections.Generic;      
  3. public class Program
  4. {
  5.         public class Film
  6.         {
  7.                                         public string name;
  8.                                         public string date;
  9.                                         public string type;
  10.                                         public string Name
  11.                                         {
  12.                                                 get{return this.name;}
  13.                                                 set {this.name = value;}
  14.                                         }
  15.                                         public string Date
  16.                                         {
  17.                                                 get{return this.date;}
  18.                                                 set {this.date = value;}
  19.                                         }
  20.                                         public string Type
  21.                                         {
  22.                                                 get{return this.type;}
  23.                                                 set {this.type = value;}
  24.                                         }
  25.                                        
  26.                
  27.                                 public Film ()
  28.                                 {
  29.                                
  30.                                 }
  31.                 public Film (string movie, string genre, string year)
  32.                 {
  33.                         name = movie;
  34.                         type = genre;
  35.                         date = year;
  36.                 }
  37.                                  public override string ToString()
  38.     {
  39.         return "Movie: " + Name + ", " + "genre - " + Type + ", " + "date " + Type + " year";
  40.     }  
  41.         }
  42.                 public class Adding
  43.                 {
  44.                 public List<Film> movies = new List<Film> ();
  45.                         public List<Film> Movies
  46.                         {
  47.                                 get{return this.movies;}
  48.                                 set {this.movies = value;}
  49.                         }
  50.                         public void HowtoAdd (Film movie1)
  51.                         {
  52.                                 Adding a2 = new Adding();
  53.                                 foreach(Film movie in a2.Movies)
  54.                                 {
  55.                                         movies.Add(movie1);
  56.                                 }
  57.                         }
  58.                         public void Izvejdane(string command)
  59.                         {
  60.                                
  61.                                 Adding a3 = new Adding();
  62.                                         foreach (Film movie3 in a3.Movies)
  63.                                         {
  64.                                                                         if (command == movie3.Name)
  65.                                                                                         {
  66.                                                                                                 a3.HowtoAdd(movie3);
  67.                                                                                         }
  68.                                                                         if (command == movie3.Type)
  69.                                                                                         {
  70.                                                                                                 a3.HowtoAdd(movie3);
  71.                                                                                         }
  72.                                                                         if (command == movie3.Date)
  73.                                                                                         {
  74.                                                                                                 a3.HowtoAdd(movie3);
  75.                                                                                         }
  76.                                         }
  77.                                                 foreach(Film element in a3.Movies)
  78.                                                 {
  79.                                         string strx = element.ToString();
  80.                                         Console.WriteLine(strx);       
  81.                                                 }
  82.                                
  83.                         }
  84.                        
  85.                 }
  86.         public static void Main()
  87.         {
  88.                
  89.                
  90.                                                 Adding a = new Adding();
  91.                                                 for (int i = 0; i<1; i++)
  92.                                                 {
  93.                                                                 Film a1= new Film();
  94.                                                                 Console.Write("Movie:");
  95.                                                                 a1.Name = Console.ReadLine();
  96.                                                                 Console.Write("Movie genre:");
  97.                                                                 a1.Type = Console.ReadLine();
  98.                                                                 Console.Write("Date:");
  99.                                                                 a1.Date = Console.ReadLine();  
  100.                                                                 a.HowtoAdd(a1);
  101.                                                 }
  102.                                                         Console.WriteLine("Command:");
  103.                                                         string command1 = Console.ReadLine();
  104.                                                          a.Izvejdane(command1);
  105.                        
  106.                                
  107.                 }
  108.         }      
  109.