Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Project description: Write a C++ program to represent a TV set. You must impleme

ID: 3818927 • Letter: P

Question

Project description:

Write a C++ program to represent a TV set.

You must implement the functionality below using classes. No credits will be given if you do not use appropriate Classes, Objects and Methods.

Your program must contain the following at the minimum:

TV is on or off

TV’s current channel if it is on

Current channel programming title or name

TV’s sound volume if it is on

Your TV can hold 10 Channels maximum

Your classes should provide the necessary methods to perform the following operations at the minimum:

Turn the TV on or off Configure channels, add more channels or remove unwanted channels

Change channel by number, i.e. go to channel 7 directly

Change channel by 1, up and down

Change sound volume by specific number, i.e. 26

Change sound volume by 1, up and down

Print out the current TV’s status: for example;

“You are currently watching Channel 7 - ABC news, sound volume @18”

Please implement a complete C++ program to provide the functionality described in the following screens.

Project description: write a C++ program to represent a TV set You must implement the functionality below using classes. No credits will be given if you do not use appropriate Classes, Objects and Methods Your program must contain the following at the minimum TV is on or off TV's current channel if it is on Current channel programming title or name TV's sound volume if it is on Your TV can hold 10 channels maximum Your classes should provide the necessary methods to perform the following operations at the minimum Turn the TV on or off Configure channels, add more channels or remove unwanted channels Change channel by number e. go to channel 7 directly Change channel by 1, up and down Change sound volume by specific number i.e. 26 Change sound volume by 1, up and down Print out the current TV's status: for example; Please implement a complete C++ program to provide the functionality described in the following Screens.

Explanation / Answer

// Too Lengthy Program

// Kindly split into multiple questions

// Functions body have been specified

/* Program is modified. By default only one channel

     Is set. You need to add other channels.

*/

#include<iostream>

#include<string>

#define MAX_CH 10

using namespace std;

class TV_func

{

Private:

int curr_channel_no;

string curr_channel_title;

int tv_sound_vol;

public:

      /* Getter Functions */

     int get_curr_channel();

    { return curr_channel_no; }

   string get_curr_channel_title();

    { return curr_channel_title; }

      int get_sound_vol();

    { return tv_sound_vol; }

      init_channel();

      showchannel() ;

        nextchannel() ;

        prevchannel() ;

        specificsoundlvl() ;

        upsoundlvl() ;

        downsoundlvl() ;

        addchannel() ;

        removechannel() ;

        displaychannel() ;

};

void TV_func::init_channel();

{

curr_channel_no = 1;

curr_channel_title = “ESPN”;

tv_sound_vol = 25;

}

void TV_func::showchannel() ;

{

cout << “Current Channel is : ”;

cout << “Channel No : “<<curr_channel_no;

cout << “Channel Name : “<<curr_channel_title;

cout << “Sound Level : “<<tv_sound_vol;

}

void TV_func::nextchannel() ;

void TV_func::prevchannel() ;

void TV_func::specificsoundlvl() ;

void TV_func::upsoundlvl() ;

void TV_func::downsoundlvl() ;

void TV_func::addchannel() ;

void TV_func::removechannel() ;

void TV_func::displayall() ;

void TV_func::displaychannel() ;

void main()

{

   int ch, curr_channel = 1, channel = 1, channel_del;

   clrscr();

   TV_func Tv_set1[MAX_CH];

   // By default one channel is set

Tv_set1[0].init_channel();

   while (1)

   {

   cout << " MENU" << " " ;

    cout << " 1. Turn TV Off" ;

    cout << " 2. Go to a different channel" ;

    cout << " 3. Go up a channel” ;

    cout << " 4. Go down a channel" ;

    cout << " 5. Go to a different sound level ";

    cout << " 6. Go up a sound volume ";

    cout << " 7. Go down a sound volume ";

    cout << " 8. Add a channel ";

    cout << " 9. Remove a channel ";

    cout << " 10. Display all channels ";

    cout << " 11. What I am watching now " ;

    cout << “ Enter your choice ====> ”;

    cin >> ch ;

    if (ch == 1)

    {

            cout << “ TV is off right now!!! ”;

            cout << “ Goodbye ”;       

exit(0) ;

    }

    else if (ch == 2)

    {

         Cout << “Enter channel number to go: ’;

         Cin >> curr_channel;

         If (curr_channel > channel)

         {

         cout << “Error in channel number ”;

         continue;

         }

        // Since array starts from 0, so current channel will be 1 less than what

       //   user specified

        TV_set1[curr_channel – 1]. showchannel();

        continue;

    }

    else if (ch == 3)

    {

       TV_set1[curr_channel]. nextchannel() ;

        continue;

    }

    else if (ch == 4)

    {

      TV_set1[curr_channel - 2]. prevchannel() ;

        continue;

    }

    else if (ch == 5)

    {

       TV_set1[curr_channel – 1]. specificsoundlvl() ;

        continue;

    }

    else if (ch == 6)

    {

     TV_set1[curr_channel – 1]. upsoundlvl() ;

        continue;

    }

    else if (ch == 7)

    {

        TV_set1[curr_channel – 1].downsoundlvl() ;

        continue;

    }

    else if (ch == 8)

    {

       TV_set1[curr_channel – 1]. addchannel() ;

       channel++;

        continue;

    }

    else if (ch == 9)

    {

        cout << “Enter channel number to remove: ’;

         cin >> channel_del;

         If (channel_del > channel)

         {

         cout << “Error in channel number ”;

         continue;

         }

        TV_set1[channel_del – 1]. removechannel() ;

        continue;

    }

    else if (ch == 10)

    {

        displayall() ;

        continue;

    }

    else if (ch == 11)

    {

        TV_set1[curr_channel – 1]. displaychannel() ;

        continue;

    }

    else

    {

        cout << "Invalid Choice" ;

    }

}