Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me on those function based on english description below. Thanks!! Question Completion Status: Question 1 In this part you will process collection of

Please help me on those function based on english description below. Thanks!!

image text in transcribedimage text in transcribed
Question Completion Status: Question 1 In this part you will process collection of NewsReport objects whose structure is shown below: enum class Week Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday struct NewsReport std: : string m_title; //title of news std: : string m_authorName; //author of the news int m_numParagraphs ;/umber of paragraphs int m_numWords; /umber of words Week m_week; //day of week in which news was published Create a function named processNewsReports that receives a collection ( std: : list ) of NewsReport objects as the parameter and returns another collection ( std: :vector ) of NewsReport objects. Your function must perform the following tasks on the received col- lection using c++ standard template library algorithms: 1. Find the first NewsReport object from the collection that was published on Tuesday and has gee or more words, and print the object's data to the standard output stream. If no such report exists, print an appropriate message. 2. Calculate the sum of the lengths of all the NewsReport object's author names from the collection, and print it to the standard output stream. 3. Create a new collection ( std: : vector ) that can hold NewsReport objects. Copy Ne wsReport objects whose author's name begins with either T' or A from the re- ceived collection ( std: : list ) into this new collection ( std: : vector ). Your function returns this collection after it is processed in the next two tasks O XIRemaining Time: 34 minutes, 10 seconds. Question Completion Status: the collection, and print it to the standard output stream. 3. Create a new collection ( std: : vector ) that can hold NewsReport objects. Copy Ne wsReport objects whose author's name begins with either 'T' or 'A' from the re- ceived collection ( std: : list ) into this new collection ( std: :vector ). Your function returns this collection after it is processed in the next two tasks. 4. Sort the vector of NewsReport objects created in the previous task in descending or- der based on the number of words in each NewsReport 5. Display each NewsReport object's data from the collection ( std: :vector ) in the fol- lowing format: Title: {title text}, Author: {author name}, Paragraphs: {number of paragraphs}, Words: {number of words}, Day: {number representing the day of the week} . Each object's data should be printed in a new line, to the standard output stream. Do not use manual loops! An algorithm that is used to accomplish a task cannot be used in accomplishing a second task. Your solution should contain only this function. Assume all necessary standard headers have been included For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). BIUS Paragraph Arial 10pt V E E X2 X2 + ABC EXE O + O XI 44

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

k) editorial content, for example of the media and of books

Answered: 1 week ago