Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 . ( 3 0 points ) Transform the following UML diagram to a TV class. TV channel: int volumeLevel: int on: bool + TV
points Transform the following UML diagram to a TV class.
TV
channel: int
volumeLevel: int
on: bool
TV
turnOn: void
turnOff: void
setChannelnewChannel: int: void
setVolumenewVolumeLeve: int: void
channelUp: void
channelDown: void
volumeUp: void
volumeDown: void
The current channel to of this TV
The current volume level to of this TV
Indicates whether this TV is onoff
Constructs a default TV object.
Turns on this TV
Turns off this TV
Sets a new channel for this TV
Sets a new volume level for this TV
Increases the channel number by
Decreases the channel number by
Increases the volume level by
Decreases the volume level by
This class should include three public data members, int channel, int volumeLevel, and bool on
and nine public functions. The function TV is a constructor, turnOn turns the TV on
turnOff turns the TV off, setChannelint newChannel sets a new channel for this TV
setVolumeint newVolumeLevel sets a new volume level for this TV channelUp increases
the channel number by one, channelDown decreases the channel number by one,
volumeUp increases the volume level by one, channelDown decreases the volume level by
one.
Do the following:
Write the TV class definition in a file named Tvh
Write the class implementation in Tvcpp
Your class should include a test driver function main This main should declare two TV
objects. One invokes channel functions. The other invokes volume levels. Display channel
and volumeLevels for each TV Make sure your program is working correctly.
Tvh
Tvcpp
main
Test run
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started