コード例 #1
0
        static void Main(string[] args)
        {
            PoliticsTeam politicPost = new PoliticsTeam();

            politicPost.CreateStory();
            politicPost.AddStyle();

            HealthTeam healthPost = new HealthTeam();

            healthPost.CreateStory();
            healthPost.AddStyle();

            GossipTeam gossipPost = new GossipTeam();

            gossipPost.CreateStory();

            Story[] stories = new Story[]
            {
                politicPost.GetStory(),
                    healthPost.GetStory(),
                    gossipPost.GetStory()
            };
            Newspaper sunday = new Newspaper();

            sunday.SetStories(stories);
            sunday.SetPrise(24.99f);

            sunday.Read();
            Console.WriteLine(NewspaperCalculator.CalcNumberOfChars(sunday));
        }
コード例 #2
0
ファイル: newspaper.cs プロジェクト: LironBayda/newCompany
        public newspaper(float price)
        {
            GossipTeam   gossipTeam   = new GossipTeam();
            PoliticsTeam politicsTeam = new PoliticsTeam();
            HealthTeam   healthTeam   = new HealthTeam();

            gossipTeam.createStory();
            politicsTeam.createStory();
            healthTeam.createStory();

            _stories = new Story[] { gossipTeam.GetStory(), politicsTeam.GetStory(), healthTeam.GetStory() };


            if (price >= 0)
            {
                _price = price;
            }
            else
            {
                Console.WriteLine("price can't be negative");
            }
        }