Question: Question 4 . 1 : Write a TV class ( without main method ) and declare its instance variables. The Default channel is 1 ,
Question : Write a TV class without main method and declare its instance variables. The Default channel is the default volume level is and the TV is off.
The turnOn method turns on this TV
The turnOff method turns off this TV
The setChannel method sets the new channel if the TV is on and the new
channel is between and
The setVolume method sets the new volume if the TV is on and the new volume
is between and
The channelUp method increases the channel number by if the TV is on and
the channel is less than
The channelDown method decreases the channel number by if the TV is on
and the channel is greater than
The volumeUp method increases the volume number by if the TV is on and
the channel is less than
The volumeDown method decreases the volume number by if the TV is on
and the volume is greater than
In the main class TestTV:
Run :
Question : Modify the code in order to initialize the first tv by the same values channel and volumeLevel when creating the tv
a create an object tv b turn on the tv
c set the channel to d set volume to
e create an object tv
f turn on the tv
g increase the channel of the tv
h increase the volume of the tv
i Show the channel and the volume
o
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
