Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hi good morning, i am pursuing computer programming as a hobby and came across this question and found it interesting. i am not sure how

hi good morning, i am pursuing computer programming as a hobby and came across this question and found it interesting. i am not sure how to do it so can any tutor shed some light or help me figure it out ?

image text in transcribedimage text in transcribed
Description A certain file, Views.txt, contains the number of times a YouTube video was viewed, liked, and disliked for each day over a certain period. A view occurs whenever someone views the video on a browser or uses the YouTube app on their mobile phone. The amount of days is unknown beforehand, but a negative view value means that there is no more data in the file. The first line of Views. tx/ contains the URL of the video (a string) followed by the starting date of the period (as three integers: day, month, and year). The remaining lines contain the number of times the video was viewed, liked, and disliked during the period (one line for each day). You are required to write a program which opens Views.tx7 and analyses the data. The results of the analyses are saved to three output files. You must use the supplied VideoViews.cpp file as the starting point of your program. Video Views. cpp should provide the following functionality in the order given: a) Open the following four files: Name of File Mode Purpose Views. txt For reading As described on Page 1. VideoStats. txt For writing To store the statistics generated in Part (c) below. Views Greater 5000.txt For writing To store the dates when there were more than 5000 views of the video. Likes LessThan_Dislikes. txt| For writing To store the dates when the number of likes was less than the number of dislikes. (b) While reading the data from Views. txt, one day at a time: (i) Update the number of days processed. (ii) Update the number of views, likes, and dislikes. (iii) If the number of likes on a certain day is less than the number of dislikes, write the date on which this happened to the file, Likes_Less Than_Dislikes.txt, followed by the amount of likes and dislikes. (iv) Find the two days when the video was viewed more than all the other days. (v) If the video was viewed more than 5000 times on a certain day, write the date of this happened to the file, Views_Greater_5000. txt, followed by the amount of viewVideoStats. txt For writing To store the statistics generated in Part (c) below. Views_Greater 5000.txt For writing To store the dates when there were more than 5000 views of the video. Likes Less Than_Dislikes. txt | For writing To store the dates when the number of likes was less than the number of dislikes. (b) While reading the data from Views.txt, one day at a time: (i) Update the number of days processed. (ii) Update the number of views, likes, and dislikes. (iii) If the number of likes on a certain day is less than the number of dislikes, write the date on which this happened to the file, Likes LessThan_Dislikes txt, followed by the amount of likes and dislikes. (iv) Find the two days when the video was viewed more than all the other days. (v) If the video was viewed more than 5000 times on a certain day, write the date on which this happened to the file, Views Greater_5000.txt, followed by the amount of views. (c) After reading the data from Views. tx/, output the following statistics to VideoStats. txt: (i) The starting date and the ending date of the analysis. (ii) The total number of days processed. (iii) The total number of views, likes, and dislikes. (iv) The average number of views, likes, and dislikes. (v) The days with the highest and second-highest amount of views. (d) After all the required processing is finished, ask the user if he/she would like to see the actual video on YouTube. If the user types I' or y to indicate yes (input as a character), you should call the show Video function with the URL of the video (read from Views. tx/) as follows: showVideo (URL) ; (e) Before terminating the program, close all open files and display a closing message to the user on the monitor. Finding the Date of the Next Day 2 You are only given the date of the first day in Views.txt. When you process each row of data from Views.txt, you must find the date of the next day. To do so, you must take into consideration the following: February has 29 days in a leap year and 28, otherwise . September, April, June, and November have 30 days All the other months have 31 days You must cater for the month changing when advancing the date. You must cater for the year changing when advancing the date

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

Given the following formula, write the corresponding JAVA code \f

Answered: 1 week ago