SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 1 Day Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 21 Dec 2017 My Price 7.00

Business Application Development Class by tonight

Hi, I need to get this assignment done for my Business Application Development Class by tonight.

The Language is Java, I have attached the assignment on here for you to see.

 

In this assignment you will model a home automation light controller that can turn on and off individual lights in a building. The controller will be an object that will have public methods to control the lights. The lights will in turn also be objects created from the Light class. A simple driver program will demonstrate the use cases of the controller.

 

1) Create a new Project. Add new class files for Light and Controller.

 

2) Light class: a) private attribute boolean isOn b) private attribute boolean isDefective c) private attribute int brightness d) private attribute double defectRate e) a default constructor that will i) set brightness to 255, turn light off and set defective to off ii) generate a random number between .05 and .15 and assign it to defectRate Hint: use Random's nextDouble() method that returns a number from 0.0 to 1.0. Get this number to the desired range of .05 to .15 by dividing it by 10 and adding an offset of .05. f) private method boolean isBurningOut() that simulates the probability of the light burning out when turning on. It should return true if the light is already defective. Otherwise it should generate a random number from 0.0 to 1.0 (with nextDouble()) and compare it to the defectRate. If the random number is less than defectRate, the light will burn out, so the method should return true. Otherwise it should return false. g) public method void turnOn() that attempts to turn on the light. It should check with the isBurningOut() method and then set the light's isOn to true if it is not burning out, otherwise, it should turn the light off and mark it as defective. h) public method void turnOff() that turns the light off. i) public method void setBrightness(int desiredBrightness) that checks the parameter for being in allowable range and sets the light brightness to the desired value. If the parameter is less than 0 or more than 255, set it to 0 or 255, respectively. j) public method char getStatus() that returns a character 'o' if the light is on with brightness less than 128, 'O' if it is on with brightness 128 or more, and dot '.' if the light is off.

 

3) Controller class: a) private array Light[] lights that holds the references to light objects b) a constructor that takes one parameter numLights that indicates how many lights are controlled by the controller i) it dimensions the lights array to size numLights ii) it creates new lights objects and stores them in the lights array (use a for loop) c) public method void printStatus() that goes through the lights array and prints the status of each light on one line. Afterwards it prints a newline to move the printing position to the next line. d) public method void turnLightOn(int lightid) that turns on the indicated light and calls printStatus() e) public method void turnLightOff(int lightid) that turns off the indicated light and calls printStatus() f) public method void setLightBrightness (int lightid, int intensity) that sets the brightness of the indicated light to the desired intensity and calls printStatus() g) public method void turnAllOn() that turns all the lights on and calls printStatus() h) public method void turnAllOff() that turns all the lights off and calls printStatus() i)

 

4) Driver program: a) Instantiate one controller object with 20 lights. b) perform the operations as described in the Requirements section.

Answers

(5)
Status NEW Posted 21 Dec 2017 06:12 AM My Price 7.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)