Trying to finish this TV submission for my java class. I am wanting this to turo
ID: 3572262 • Letter: T
Question
Trying to finish this TV submission for my java class. I am wanting this to turon on the tv and set the channel for it.
package televisiontest;
import java.util.Scanner;
/**
*
* Programmer: Stephen D. Dunn
* Date: 12/3/2016
* Institution: UMUC CMIS141 Introduction to Programming Java
* Program: TelevisionTest Description:
* Evaluation for the Television, its functions and channels.
*
*/
public class TelevisionTest {
public class Television {
//My Fields
public boolean tvIsOn = false;
public int Channel = 8;
//Initial condition
public Television () {
this.tvIsOn = false;
this.Channel = 0;
}
//Parameters
public void Channel(boolean tvIsOn, int Channel) {
this.tvIsOn = tvIsOn;
this.Channel = Channel;
}
//Turning on my TV
public void TvPower () {
this.tvIsOn = true;
}
//Set Channel
public void setChannel (int Channel) {
this.Channel = Channel;
}
//Get Channel
public int getChannel () {
return this.Channel;
}
}
public static void main(String[] args) {
Television Television1 = new Television(System.in);
System.out.println("Welcome to your Entertainment experience!" );
System.out.println("Your Television is Currently :" + tvIsOn );
System.out.println("Your Currently watching Channel: " + ;
Television Television2 = new Television(true, 2);
System.out.println("Television Power is: " + Television.tvIsOn);
System.out.println("Please Select Channel for Viewing : ");
int Channel = scanner.nextInt();
}
}
Explanation / Answer
TelevisionTest.java
public class TelevisionTest {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
Television Television1 = new Television();
System.out.println("Welcome to your Entertainment experience!" );
System.out.println("Your Television is Currently :" + Television1.tvIsOn );
System.out.println("Your Currently watching Channel: " + Television1.getChannel());
Television Television2 = new Television();
Television2.tvIsOn = true;
System.out.println("Television Power is: " + Television2.tvIsOn);
System.out.println("Please Select Channel for Viewing : ");
int Channel = scanner.nextInt();
Television2.setChannel(2);
System.out.println("Your Currently watching Channel: " + Television2.getChannel());
}
}
Television.java
public class Television {
//My Fields
public boolean tvIsOn = false;
public int Channel = 8;
//Initial condition
public Television () {
this.tvIsOn = false;
this.Channel = 0;
}
//Parameters
public void Channel(boolean tvIsOn, int Channel) {
this.tvIsOn = tvIsOn;
this.Channel = Channel;
}
//Turning on my TV
public void TvPower () {
this.tvIsOn = true;
}
//Set Channel
public void setChannel (int Channel) {
this.Channel = Channel;
}
//Get Channel
public int getChannel () {
return this.Channel;
}
}
Output:
Welcome to your Entertainment experience!
Your Television is Currently :false
Your Currently watching Channel: 0
Television Power is: true
Please Select Channel for Viewing :
2
Your Currently watching Channel: 2
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.