Develop classes with the instance variables and methods

Assignment Help JAVA Programming
Reference no: EM132260708

All televisions have basic functionality to turn on and off, set the channel and volume. When paired to a TV, the remote control has buttons which invoke this functionality to operate the TV.

For this assignment, you will individually develop the Television and RemoteControl classes. You will demonstrate their functionality through a simple menu via the console in the TVApplication class.

Methodology
You will develop three classes with the following instance variables and methods

• Television class
• Stores instance variables for power, channel, maxChannel and volume (all private)
• maxChannel is final
• power has get/set methods
• channel has get/set methods. The set method ensures the television's channel stays between 1 and maxChannel at all times
• volume has a get method
• volume has a private set method. The set method ensures volume percentage stays between 0 and 100 at all times
• Has a volumeDown() method which decrements volume percentage by one
• Has a volumeUp() method which increments volume percentage by one
• maxChannel has a get method but no set method
• Constructors set volume to 0 and channel to 1
• Default constructor Television() sets maxChannel to 10
• Constructor Television(int max) sets maxChannel to max. If max is less than 2 then maxChannel is set to the value 10.
• toString method returns a string representation of a TV object.

Note: No other methods/instance variables are to be defined

Three examples of string representations of a Television object (i.e. toString method should return a string representation as follow):
[Television is: on? NO. CHANNEL: 1/10. VOLUME: 0% (muted)]
[Television is: on? YES. CHANNEL: 2/10. VOLUME: 50%]
[Television is: on? NO. CHANNEL: 2/10. VOLUME: 100%]

• RemoteControl class
• Maintains a Television instance variable with get and set methods
• Has a single constructor which takes as input a Televisionobject
• Has the powerButton() method to switch the TV on and off
• When the TV is switched on, the method ochannelDownButton() decreases the channel. If at 1, the channel is changed to maxChannel

o channelUpButton() increases the channel. If at maxChannel, the channel is changed to 1.
o volumeUpByHalf() increases the volume by 50% ovolumeDownByHalf() decreases the volume by 50%
Note: No other methods/instance variables are to be defined
TVApplication class has a single main method which instantiates a RemoteControl object. The user may repeatedly press buttons on the remote until they decide to stop watching TV. Use the Scanner class to read in a number from the console corresponding to a button on the remote.
Program Interaction
Sample interaction with the TVApplication main method.
[Television is: on? NO. CHANNEL: 1/10. VOLUME: 0% (muted)]

Press a Button on the Remote Control
1. Power 2. Volume Up by 50% 3. Volume Down by 50% 4. Channel Up 5. Channel Down 6. Go outside 2
Volume Up by 50% Button Pressed

[Television is: on? NO. CHANNEL: 1/10. VOLUME: 0% (muted)]

Press a Button on the Remote Control
1. Power 2. Volume Up by 50% 3. Volume Down by 50% 4. Channel Up 5. Channel Down 6. Go outside 1
Power Button Pressed

[Television is: on? YES. CHANNEL: 1/10. VOLUME: 0% (muted)]

Press a Button on the Remote Control
1. Power 2. Volume Up by 50% 3. Volume Down by 50% 4. Channel Up 5. Channel Down 6. Go outside 2
Volume Up by 50% Button Pressed

[Television is: on? YES. CHANNEL: 1/10. VOLUME: 50%]
Press a Button on the Remote Control
1. Power 2. Volume Up by 50% 3. Volume Down by 50% 4. Channel Up 5. Channel Down 6. Go outside 4
Channel Up Button Pressed

[Television is: on? YES. CHANNEL: 10/10. VOLUME: 50%]
Press a Button on the Remote Control
1. Power 2. Volume Up by 50% 3. Volume Down by 50% 4. Channel Up 5. Channel Down 6. Go outside 5
Channel Down Button Pressed
[Television is: on? YES. CHANNEL: 1/10. VOLUME: 50%]
Press a Button on the Remote Control
1. Power 2. Volume Up by 50% 3. Volume Down by 50% 4. Channel Up 5. Channel Down 6. Go outside 5
Channel Down Button Pressed

[Television is: on? YES. CHANNEL: 2/10. VOLUME: 50%]

Press a Button on the Remote Control
1. Power 2. Volume Up by 50% 3. Volume Down by 50% 4. Channel Up 5. Channel Down 6. Stop watching TV and go outside6

Reference no: EM132260708

Questions Cloud

Cylindrical part that can be made on screw machine : As a new engineer you designed a cylindrical part that can be made on a screw machine.
Modify the code to terminate the connection : Modify the code to terminate the connection when the client sends the message "End Session" to the server. Modify the code such that communication.
Separating juveniles from their families and communities : What do you think about our current system of separating juveniles from their families and communities?
Flat organization is the same as short organization : Mission and vision statements are the same and should be included in a business plan. A flat organization is the same as a short organization.
Develop classes with the instance variables and methods : Develop three classes with the instance variables and methods - develop the Television and RemoteControl classes. You will demonstrate their functionality
The civil rights act was signed into law : The Civil Rights Act was signed into law in 1964 during the decade commonly referred to as the human rights decade.
How did this change by the end of the war : Briefly discuss the causes and course of the First Punic War. What advantages did both sides have at the beginning of the war?
Sole proprietorship and entrepreneurship are defined : Sole proprietorship and entrepreneurship are defined as the same.
What were the reforms carried out by sulla as dictator : What were the reforms carried out by Sulla as dictator, and why do you think he initiated these kinds of reforms?

Reviews

inf2260708

9/4/2019 3:02:50 AM

I received the best quality work prepared as per the requirements. I got more than my expectations. Very thanks to the team for providing me with excellent services.

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd