Beispiel #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));
        }
 internal static int CalcNumberOfChars(Newspaper newspaper)
 {
     foreach (Story story in newspaper.GetStories())
     {
         numberOfChars = numberOfChars + story.m_body.Length;
     }
     return(numberOfChars);
 }
Beispiel #3
0
        internal static int CalcNumberOfChars(Newspaper newspaper)
        {
            int sum = 0;

            for (int i = 0; i < newspaper.GetStories().Length; i++)
            {
                sum = sum + newspaper.GetStories()[i].GetTitle().Length + newspaper.GetStories()[i].GetBody().Length;
            }
            return(sum);
        }
        static void Main(string[] args)
        {
            Story politicStory = new Story("New President", "Kanye West is the new President of the USA", "column");
            Story healthStory  = new Story("Coronavirus", "Coronavirus is defeated", "research paper");
            Story gossipStory  = new Story("Celebrity in Love", "Madonna has a new boyfriend", "review");

            string[] _stories = { "politicStory", "healthStory", "gossipStory" };
            for (int i = 0; i < _stories.Length; i++)
            {
                Console.WriteLine(_stories[i]);
            }


            Newspaper n = new Newspaper();

            float newPrice = 50;

            n.SetPrice(newPrice);
            n.GetPrice();
            n.SetStories(_stories);
            n.GetStories();
            n.Read();
            Console.WriteLine(n);
        }
 internal static int CalcNumberOfChars(Newspaper newsPaper)
 {
     return(newsPaper.title.Length + newsPaper.body.Length);
 }
Beispiel #6
0
 internal static int CalcNumberOfChars(Newspaper newspaper)
 {
     return(numberOfChars++);
 }
 internal static int CalcNumberOfChars(Newspaper x)
 {
     return(x.ToString().Length);
 }