Advertisement
Guest User

Class Program

a guest
Nov 26th, 2013
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Zad4
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int dataWydaniaPrzed2010 = 0;
  14.            
  15.             List<BookShop> ListOfBooks = new List<BookShop>();
  16.             for (int i = 0; i < 2; i++)
  17.             {
  18.                 Console.Write("Podaj tytul ksiazki: ");
  19.                 string tytul = Console.ReadLine();
  20.                 Console.Write("Podaj nazwisko autora ksiazki: ");
  21.                 string autor = Console.ReadLine();
  22.                 Console.Write("Podaj rok wydania ksiazki: ");
  23.                 int dataWydania = int.Parse(Console.ReadLine());
  24.                 Console.Write("Podaj cene ksiazki: ");
  25.                 double cena = double.Parse(Console.ReadLine());
  26.  
  27.                 BookShop ksiazka = new BookShop(tytul, autor, dataWydania, cena);
  28.                 ListOfBooks.Add(ksiazka);
  29.             }
  30.            
  31.  
  32.             foreach(BookShop ksiazka in ListOfBooks)
  33.             {
  34.                
  35.                 if (ksiazka.ReleaseBookDateBefore2010())
  36.                     dataWydaniaPrzed2010++;
  37.                 if (ksiazka.LemsBook())
  38.                     Console.WriteLine("{0} zostala napisana przez Lema", ksiazka.bookTitle);              
  39.             }
  40.  
  41.             Console.WriteLine("Liczba wydanych ksiażek przed 2010: {0}", dataWydaniaPrzed2010);
  42.            
  43.             Console.ReadKey();
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement