Give four operations (methods) of a class Television used to represent a typical
ID: 3809687 • Letter: G
Question
Give four operations (methods) of a class Television used to represent a typical television. Give three properties (instance variables) of the class Television. Write a statement that would create an object (instance) of the class Television. What method of the class Television that would be used in this statement called? Give an example signature (first line) for this method. What are the primary differences between Strong AI and Weak AI? Find the errors in the following code. Rewrite the code correctly on your answer sheet and circle the places where you made corrections. (Don't submit the question sheet!) public int foo {bar int} (bar * bazzle); Write an if statement that uses a variable called temperature of type double to print "It's cold." if the temperature represents cold weather. It should print "very cold", "normal", "warm" and "hot" depending on the temperature. You get to choose the ranges and should try to do this in a single if statement. Write a loop that finds the largest integer (say x) whose cube is less than some provided integer (say max). Describe the process of Requirements Analysis and why it is so important.Explanation / Answer
As per the Chegg rules, we can answer till 4 questions. The following is the code.
Create a file named Television.java and place the code in that file.
public class Television{
String type;
double size;
String brand;
public Television(double s,String t, String b){
size=s;
brand=b;
type=t;
}
public Television(){}
public double getSize(){ return size;}
public String getType() { return type;}
public String getBrand(){ return brand;}
public void setSize(double s){ size=s;}
public void setType(String s){ type=s;}
public void setBrand(String b){brand=b;}
public static void main(String []args){
Television t = new Television();
t.setSize(55.2);
t.setType("Color Television");
t.setBrand("Sony");
System.out.println("Television information:");
System.out.println("Size:" + t.getSize());
System.out.println("Brand:" + t.getBrand());
System.out.println("Type:" + t.getType());
}
}
output:
sh-4.3$ javac Television.java
sh-4.3$ java Television
Television information:
Size:55.2
Brand:Sony
Type:Color Television
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.