Write a complete Java program to do the following. The attributes of a TV object are the channel, the volume, and the flag (or switch) indicating the channel No., volume level and whether the TV is on or off respectively. Use appropriate datatypes for the data members.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 9PE
icon
Related questions
Question
Write a complete Java program to do the following.
The attributes of a TV object are the channel, the
volume, and the flag (or switch) indicating the
channel No., volume level and whether the TV is on
or off respectively. Use appropriate datatypes for the
data members.
The methods of the class perform the following
actions:
• Turn the TV on or off ( Toggling)
• Set the channel to an integer in the range 0 to 99 ,
inclusive of both lower and upper limits.
• Raise or lower the volume by one unit. The volume
can range from 0 to 20. (Inclusive of both lower and
upper limits. Include conditions to check the range)
display method displays the following
i) whether the TV is on or off.
ii) channel volume.
iii) channel number
Write a TV class containing the required instance
variables (private) and all relevant methods and a
constructor. A newly created TV object is set to off
with the channel set to 2 and the initial volume 10.
Keep TV class in mypacks package. Write a Driver
class to include a main...) method that tests the
methods of the TV class by creating array of TV
objects
mypacks.driverclasses package.
and
make
this
class
a
part
of
Transcribed Image Text:Write a complete Java program to do the following. The attributes of a TV object are the channel, the volume, and the flag (or switch) indicating the channel No., volume level and whether the TV is on or off respectively. Use appropriate datatypes for the data members. The methods of the class perform the following actions: • Turn the TV on or off ( Toggling) • Set the channel to an integer in the range 0 to 99 , inclusive of both lower and upper limits. • Raise or lower the volume by one unit. The volume can range from 0 to 20. (Inclusive of both lower and upper limits. Include conditions to check the range) display method displays the following i) whether the TV is on or off. ii) channel volume. iii) channel number Write a TV class containing the required instance variables (private) and all relevant methods and a constructor. A newly created TV object is set to off with the channel set to 2 and the initial volume 10. Keep TV class in mypacks package. Write a Driver class to include a main...) method that tests the methods of the TV class by creating array of TV objects mypacks.driverclasses package. and make this class a part of
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage