Question
Topic: Java Programming Hello, I have the following code attached below, and keep getting told that Television on the 23rd line cannot be resolved to
Topic: Java Programming
Hello,
I have the following code attached below, and keep getting told that "Television" on the 23rd line "cannot be resolved to a type". It happens on this line of code...
Television portable = new Television("Sharp", 19);
Can you tell me how to fix this?
Beginning of code...
import java.util.Scanner;
public class TelevisionDemo {
{}
public static void main(String[] args)
{
// //create a Scanner object to read from the keyboard
Scanner keyboard = new Scanner(System.in);
// //declare variables
int station; //the user's channel choice
// //HERE IS WHERE YOU DO TASK #5
Television portable = new Television("Sharp", 19);
portable.power();
System.out.println("A " + portable.getScreenSize() + " inch " +
portable.getManufacturer() + " has been turned on.");
System.out.print("What channel do you want? ");
station = keyboard.nextInt();
//change the channel on the television
portable.setChannel(station);
portable.decreaseVolume();
portable.decreaseVolume();
System.out.println("Channel: " + portable.getChannel() +
" Volume: " + portable.getVolume());
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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