Question: Question 1 [1 mark] Define a class Television with two private variables: Brand (String) and Screen Size (double). [1 mark] Implement a constructor with Two
Question 1
[1 mark] Define a class Television with two private variables: Brand (String) and Screen Size (double). [1 mark] Implement a constructor with Two parameters. The first parameter should initialize the Brand variable and the second parameter should initialize the Screen size variable. [2 marks] Implement set method for Brand, and get method for Screen size. [1 mark] Implement the toString() method, which should return all variable values as String. [2 marks] Implement a method calcResolution( double d ), which computes and returns the resolution of the television. The resolution is calculated as follows: resolution = d * screen size
Finally, test the Television class using a tester class as follows. [1 mark] Create a new Television object with Brand = Samsung, and Screen Size = 40. [1 mark] Then print the Television information using the toString() method. [1 mark] Finally, print the resolution of the Television using the calcResolution method with parameter d = 100.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
