Question: [C#] I need to implement this class and need to give it a constructor, and getter/setter. There's two parts to this, but as long as
[C#] I need to implement this class and need to give it a constructor, and getter/setter. There's two parts to this, but as long as the first part is done it will be fine.
Part 1:
![[C#] I need to implement this class and need to give it](https://s3.amazonaws.com/si.experts.images/answers/2024/09/66dfc71380bd1_52366dfc713181a0.jpg)
Part 2:

Here is the code I currently have:

1. Implement the Television class. Each Television has a brand name (a string), a price (use decimal), and a size (measured diagonally in inches). Give the class a constructor, and getter/setter methods for each of the three data attributes. A. Note that price is actually a decimal, not a double , value. a When a Television object s created using the default (no-argument) constuctor,the price and size should be zero, and the brand should be the empty string (, NOT the value null. C. Remember to validate the input to the setter methods. If you're given a negative value for price or size, reject the new value and keep the current value, instead. Similarly, if the SetBrand method is given a null value, it should reject this null value and keep the current value, instead. D. You also need to implement a Print method, which should print out a message in the following format: Brand: Sony Price: 1000.17 Size:10.5 E. The class definition is already partially provided for you in the starter solution. 1. If you haven't done so already, implement two constructors for your Television class: A. A default constructor that initializes the brand to " (the empty string- NOT the null value), the price to zero, and the size to zero B. A constructor which takes three arguments: the brand, the price, and the screen's size, in that order. The constructor should copy these parameters into the appropriate data fields in the object. Note that these fields should only be set to valid values (e.g., no negative prices, or null for the brand, etc, etc)- if given an invalid value, the default value that the default constructor assigns should be used, instead. 2. Implement the PrintArrayOfTVs method in the Television Handler class. 3. Create an array that can hold a bunch (at least 5) of references to Television objects, within the PrintArrayOfTVs method. This will probably look something like: Television [] aBunchofTVsnew Television [5]; 4. Go through, and create a new Television object for each slot in the array. Your code should continue to work correctly even if you decide to change the size of the array (in the previous step) some time in the future. You'll probably end up having a line like the following in your code (assuming that you've decided to create a constructor for your Television class (which you should do)) aBunchOfTVs [0] new Television ("Brand X", 10, 42); = For each you should give it the brand "Brand X", the size should be 42, and the price should be 10 + the index in the array that the Television is being assigned to 5. Go through (using a separate loop) and call the Print0 method on each of your objects. An example of correct output is: Brand:Brand X Price: 10 Size:42 Brand:Brand X Price: 11 pub lic class Te levision public Television ) public Television (string br, decimal pr, double si) public string GetBrand() return "YOU NEED TO IMPLEMENT THIS!" public void SetBrand (string newValue) public void Print ()
Step by Step Solution
There are 3 Steps involved in it
To implement the Television class as described follow these steps Step 1 Define the Class with Field... View full answer
Get step-by-step solutions from verified subject matter experts
