Question
IN C# please Create an interface called ISmartBulb. It must have: A method called turnOn which takes no parameters and returns void A method called
IN C# please
Create an interface called ISmartBulb. It must have:
A method called turnOn which takes no parameters and returns void
A method called turnOff which takes no parameters and returns void
A method called increaseBrightness which takes in a percentage (int) of how much to increase, and returns void.
A method called decreaseBrightness which takes in a percentage (int) of how much to decrease, and returns void.
Create an abstract class called SmartDevice. It must have:
A private attribute called manufacturer which can hold a string.
A private attribute called model which can hold a string
A private attribute called version which can hold an integer.
A default constructor which sets manufacturer and model to "Unknown" and version to 1.
An overloaded constructor which takes in manufacturer, model and version and sets them.
Getters for manufacturer, model and version
An abstract method printStatus which takes no parameters and returns a void.
Create a concrete class called Bulb that inherits from SmartDevice and implements ISmartBulb. It must have:
A private attribute brightness which is an int.
An overloaded constructor which takes in manufacturer, model and version and sets them, it should also set brightness to 0.
Implement all the methods from the interface. turnOn should set brightness to 100%, turnOff should set it to 0. increaseBrightness should increase the current brightness by the amount passed in, decreaseBrightness should decrease the current brightness by the amount passed in.
Note brightness should never be higher than 100, or lower than 0. If you are told to increase above 100, simply set the brightness to 100. If you are told to decrease below 0 set the brightness to 0.
Implement the abstract method you inherited from your parent. It should print out something like:
Manufacturer: Philips Hue Model: C100 Version: 1 Brightness: 50
Note "Philips Hue", "C100", 1 and 50 above should be the actual values for your object, not these examples.
In your driver's main method do the following:
Instantiate a Bulb object, it should have a manufacturer of "GE", a model of "Smart Bulb" and a version of 1.
Increase the brightness of the bulb by 50%
Call printStatus on your bulb.
Sample Output:
Manufacturer:GE
Model:Smart Bulb
Version:1
Brightness:50
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