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.
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.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question

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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps

Knowledge Booster
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.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education