Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Advances In Databases And Information Systems 14th East European Conference Adbis 2010 Novi Sad Serbia September 2010 Proceedings Lncs 6295

Authors: Barbara Catania ,Mirjana Ivanovic ,Bernhard Thalheim

2010th Edition

3642155758, 978-3642155758

More Books

Students also viewed these Databases questions

Question

Transition diagram for: (aa|bb)*((ab|ba)(aa|bb)*(ab|ba)(aa|bb)*)*

Answered: 1 week ago

Question

neuromarketing helps sell products by what

Answered: 1 week ago

Question

What is electric dipole explain with example

Answered: 1 week ago

Question

What is polarization? Describe it with examples.

Answered: 1 week ago

Question

5. Discuss the role of the Web in career management.

Answered: 1 week ago