Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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