Java code please 1. Appliance and TV by CodeChum Admin Create a class called Appliance. An appliance simply has a: brand (a text) a cost (a monetary value) a power status (ON or OFF) Power status, brand and cost should not be accessible out the class or its hierarchy of inheritance. It has one constructor that accepts a string and double for the brand and cost respectively (prints "Appliance Constructor" as well). It sets the power status to OFF. Apart from the getters, it also has two public methods, power(), and toString(). power() turns on the appliance if it is off, otherwise, if it is on, it turns the appliance off. toString() simple returns a String object representing the Appliance in this format ("Brand: xxxx, Cost: PhP xxxx.xx, Power: xx"). Create another class called Television. Television is an Appliance. It only has the following additional private attributes: type (whether Smart or Non-Smart) volume (0 - 100) channel (1 - 100) It should have the following methods: getters void volumeUp() - increases the volume by 1 (possible only when TV is ON) void volumeDown() - decreases the volume by 1 (possible only when TV is ON) void channelUp() - increases the channel by 1 (possible only when TV is ON) void channelDown() - decreases the channel by 1 (possible only when TV is ON) String toString() - overriding Appliance's. It should include type, volume, and channel in this format ("Brand: xxxx, Cost: PhP xxxx.xx, Power: xx, Type: xxxx, Volume: xx, Channel: xx"). A lone constructor is to be implemented with a type, brand, and cost as an argument. It sets the volume to 0 and channel to 1. And it prints "Television Constructor" as well. Input The first line contains all arguments for creating a Television object. The next line contains m which is the number of operations. The following lines are the m operations. For the type, 1 is used for Smart, 2 for Non-Smart. The operations are described below: 1 - volumeUp 2 - volumeDown 3 - channelUp 4 - channelDown 5 - toString 6 - power Philips·23000·2 9 1 1 1 2 3 3 3 4 5 Output Apart from the outputs of the constructors, only operation 5 prints an output. It prints the String toString returns. Appliance·Constructor Television·Constructor Brand:·Philips,·Cost:·PhP·23000.00,·Power:·OFF,·Type:·Non-Smart,·Volume:·0,·Channel:·1

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Java code please 1. Appliance and TV by CodeChum Admin Create a class called Appliance. An appliance simply has a: brand (a text) a cost (a monetary value) a power status (ON or OFF) Power status, brand and cost should not be accessible out the class or its hierarchy of inheritance. It has one constructor that accepts a string and double for the brand and cost respectively (prints "Appliance Constructor" as well). It sets the power status to OFF. Apart from the getters, it also has two public methods, power(), and toString(). power() turns on the appliance if it is off, otherwise, if it is on, it turns the appliance off. toString() simple returns a String object representing the Appliance in this format ("Brand: xxxx, Cost: PhP xxxx.xx, Power: xx"). Create another class called Television. Television is an Appliance. It only has the following additional private attributes: type (whether Smart or Non-Smart) volume (0 - 100) channel (1 - 100) It should have the following methods: getters void volumeUp() - increases the volume by 1 (possible only when TV is ON) void volumeDown() - decreases the volume by 1 (possible only when TV is ON) void channelUp() - increases the channel by 1 (possible only when TV is ON) void channelDown() - decreases the channel by 1 (possible only when TV is ON) String toString() - overriding Appliance's. It should include type, volume, and channel in this format ("Brand: xxxx, Cost: PhP xxxx.xx, Power: xx, Type: xxxx, Volume: xx, Channel: xx"). A lone constructor is to be implemented with a type, brand, and cost as an argument. It sets the volume to 0 and channel to 1. And it prints "Television Constructor" as well. Input The first line contains all arguments for creating a Television object. The next line contains m which is the number of operations. The following lines are the m operations. For the type, 1 is used for Smart, 2 for Non-Smart. The operations are described below: 1 - volumeUp 2 - volumeDown 3 - channelUp 4 - channelDown 5 - toString 6 - power Philips·23000·2 9 1 1 1 2 3 3 3 4 5 Output Apart from the outputs of the constructors, only operation 5 prints an output. It prints the String toString returns. Appliance·Constructor Television·Constructor Brand:·Philips,·Cost:·PhP·23000.00,·Power:·OFF,·Type:·Non-Smart,·Volume:·0,·Channel:·1
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY