Question
Topic: Java Programming Hello, I have the following code attached below, and keep getting told that Television on the 11th line cannot be resolved to
Topic: Java Programming
Hello,
I have the following code attached below, and keep getting told that "Television" on the 11th line "cannot be resolved to a type". It happens on this line of code...
Television bigScreen = new Television("Toshiba", 55);
Can you tell me how to fix this?
Beginning of code...
public class TelevisionDemo
{
public static void main(String[] args) { Scanner keyboard = new Scanner (System.in); int station; Television bigScreen = new Television("Toshiba", 55); bigScreen.power(); System.out.println("A " + bigScreen.getScreenSize() + " inch " + bigScreen.getManufacturer() + " has been turned on."); System.out.print("What channel do you want? "); station = keyboard.nextInt(); System.out.println(station); bigScreen.setChannel(station); bigScreen.increaseVolume(); System.out.println("Channel: " + bigScreen.getChannel() + " Volume: " + bigScreen.getVolume()); System.out.println("Too loud! Lowering the volume."); bigScreen.decreaseVolume(); bigScreen.decreaseVolume(); bigScreen.decreaseVolume(); bigScreen.decreaseVolume(); bigScreen.decreaseVolume(); bigScreen.decreaseVolume(); System.out.println("Channel: " + bigScreen.getChannel() + " Volume: " + bigScreen.getVolume()); System.out.println(); // For a blank line // HERE IS WHERE YOU DO TASK #5 Television portable = new Television("Sharp" , 19); // creating one more instance of this class. portable.power(); // calling power fucntion . System.out.println("A " + portable.getScreenSize() + " inch " + portable.getManufacturer() + " has been turned on."); System.out.print("What channel do you want? "); // asking for channel no. int user_channel = keyboard.nextInt(); // taking input. System.out.println(user_channel); portable.setChannel(user_channel); // calling setChannel and setting the object's channel to user_channel. portable.decreaseVolume(); portable.decreaseVolume(); // calling decreaseVolume two times. System.out.println("Channel: " + portable.getChannel() + " Volume: " + portable.getVolume()); // printing the new values. }
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started