Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i need this assignment im doing a group project (the detail are in the picture) i got assign to do the classes for the streetlight
i need this assignment
im doing a group project (the detail are in the picture) i got assign to do the classes for the streetlight and temperature. the streetlight class will just need the light color and and intensity of the light with frequency to determine. it will determine when its dim and when to turn on and off. also when to turn on when a emergency is near by,. The temperature class determine when to turn on/dim and off depending on the temperature. it should be base on the details in the picture.
i have a rough draft of it. just need it to be more detailed plz
code is below:
//-------------- Streetlight.java-----------
public class Streetlight {
private Status status;
public Streetlight() {
}
public Streetlight(Status status) {
this.status = status;
}
public String getStatus() {
return status.name();
}
public void setOff() {
this.status = Status.OFF;
}
public void setOn() {
this.status = Status.ON;
}
public void setFlickerRed() {
this.status = Status.FLICKER_RED;
}
@Override
public String toString() {
return "Streetlight [status=" + status + "]";
}
}
// enum of status of the light,
// since a street light LED can be in only one state at a time
enum Status {
ON, OFF, DIM, FLICKER_RED
}
//---------- Temperature.java -----------------
public class Temperature {
private float value;
private String unit; // degree / Fahrenheit
public Temperature() {
}
public Temperature(float value, String unit) {
this.value = value;
this.unit = unit;
}
@Override
public String toString() {
return "Temperature [value=" + value + ", unit=" + unit + "]";
}
}
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