X1241: Codewit Juan: videos with C++ class

Code along with Juan's example and implement the Video class that does the following:

  1. Stores the following data using information hiding:
    • title - the title of a video
    • desc - words that describe the contents of a video
    • length - a decimal number of minutes of the video's length
    • rating - a whole number rating of the video from 1-5, inclusively
  2. Contains a public function called initVar that prompts the user and gets their response for the following:
    • "Enter title:\n" - and captures a line of the user's input as the title
    • "Enter desc:\n" - and captures a line of the user's input as the desc
    • "Enter length:\n" - and captures a number of the user's input as the length
    • "Enter rating:\n" - and captures a number of the user's input as the rating
  3. Contains a public function called printInfo that displays the following, each followed by an endline:
    • "Title of vid: " followed by the value of title
    • "Description: " followed by the value of desc
    • "Length is: " followed by the value of length
    • "Rating is: " followed by the value of rating

Complete only the code within Video class

Your Answer:

Reset

Practice a different C++ exercise

Feedback

Your feedback will appear here when you check your answer.