Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions