Question: This needs to be in C++ - You will ask the user for their average daily screen time in hours as well as their average
This needs to be in C++



- You will ask the user for their average daily screen time in hours as well as their average daily study (or homework) time they spend in hours. - Validate the user's input to make sure they enter a number 0 through 24 . If they don't then give them an error messoge and tell them to enter again and then read it in again. A flow chart representing the algorithm for this is belaw. - Then, hased an what they answer, you vill print out adviee an how they should spend their time. - You must use logical operators in your solution. - Below is the logic you should use to print your statements: Scremen tirne less than or equal to 2 arid study time is less than 2 then print '"You may warnt ta stucty more - Below is the logic you should use to print your statements: - Sereen time less than or equal to 2 and study time is less than 2 then print "You may want to study more if you wish to learn anything." - Scremn time less than or equal to 2 arid study tirne greater than or equal ta 6 then print 'You need to socialize with people more often n 5creen time greater then 2 and study time greater than or equal to 6 then print "You need to socialize vith people more often and get aff that phone." 0 Screen time less than or equal to 2 and study time greater than or equal to 2 , but less than 6 , then print "You manage your time vell." - Serean time grenter than 2 and study time less than 6 then print W hat are you gaing to do if you lase that phone? It is interfering with your ability to have a real life." - Make sure to test yaur code with all 4 sample outputs belaw to make sure your code logit is correct! SAMPLE OUTPUT SAMPLE OUTPUT 1 AVG CAILY SCREFN TTNE HOURS: 2 Rounding =0 the nearest hour, how rany hours is your daily average study or homewark ime:? AVG DAILY STUDY Or HOMEWORK HOURS: 6 You need zo socialize with people rore otten. SAMPLE OUTPUT 2 (CHECKS YOUR WHILE LOOPS) Rounding to the nearest hour, how rany hours is you daily avorage HONE screen time? AVG DAILY SCRE-TINE HOUR.: 8 AH BARF! Tha =5 an invalin number! Fintar of through 24=28 OH BRRe! Tha-'s an invalid numbor! Enter of through 24:1 Rounding to the nearest hour, how Iany hours is your daily aperage atudy or houework zime? AVG LAILY GTUDY or LLACEWORK LlOURS: 9 SAMPLE OUTPUT 2 (CHECKS YOUR WHILE LOOPS) Rounding =0 the hearest hour, how fany houre 1 y you dally average Hokr screen time? AVG LNILY GCEEEN-TINE HOURS: - OA BAR.E! Tha:'g an invalid number! Enter 0 through 24:1 kounding -c he rearesL hour, how fany hours is your daily average sluiy or houewurk time? AVG CATTY ETIDY CF HOMFWOR HOIRR.S: 96 OH Bare! Tha-'5 an invalid number! Entar 0 through 24:3 ?cu ranage yaur time well. SAMPLE OUTPUT 3 Rounding 50 the nonrest hour, how many hours is you daily avorage JHone screcn time? AVG DAILY SCREN-TINE HOURS: 3 Rounding zo the nearest hour, how fany houre fe your daily ayerage etudy or houework -ime? AVG LALL II'UDY Cr HCXEWUKK HOURS: 6 You meed zo scelallae with people nore often and ge= off tha= phone. SAMPLE OUTPUT 4 Rounding to the nearest hour, how rany hours is you daily avorage JHone scroen time? AVG DAILY SCREIIN-TINE HOUR.S: I Rounding t0 the nearest hour, how many hours is your daily average study or homework zime? AVG DAILY STUDY OF HOMEWORK HOURS: You nay want to study rore 1fy ou wish zo learn any-hing
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
