Foundations of Computer science COP3014 Provide all copiable code in C++ format
ID: 3716207 • Letter: F
Question
Foundations of Computer science COP3014
Provide all copiable code in C++ format
Directions are as follows:
Make a C++ project code file, as described below (in the function specifications). (Note: There will be no actual "real" data, since there are no sensors incorporated. Use instead a randum number generator, to make up random data for the sensors (ie. humitity, temperature, ect.)..
Function Specifications are as follows:
User (e.g. The City) will be able to use this code on smart streetlights that gather information from external sensors (not provided). The program will then analyze the information and make appropriate changes to the smart streetlights LED light bulbs.
The program will have three settings for the LED’s:
light on
light off
light dim
These settings will depend on an analysis of the information the streetlight will be able to pick up with the following sensors: light, weather (humidity and temperature) and motion.
Sensors that can detect humidity and temperature will be able to analyze and differentiate various weather conditions. A light sensor will determine the setting for the LED accordingly. The data picked up from these sensors will be stored and sent to the location (i.e. city).
A motion detector on the smart streetlight will pick up walking pedestrians or moving vehicles that will tell the smart streetlight, whether or not the lights should be on. If there is no motion detected within a certain given amount of time, the light will dim. Once in dim mode, the light will not be using up as much energy as before. If there is motion detected the LED will be on to the brightest intensity.
The street light will also be able to help the traffic run smoother. With traffic monitoring sensors it can monitor how the traffic flows throughout the day. The data collected can then be used to send a signal to nearby traffic lights. The traffic lights will know which streets are the busiest and therefore change light color accordingly.
As aforementioned, the lights will have the ability to use motion sensors to turn on when someone is passing by. Therefore, another thing we want to add to this streetlight is to have the ability to flicker red when an ambulance or fire truck is on its way about to pass through. This is very important in a busy city place so that an emergency vehicle can get to its destination as quick and safely as possible.
Design Specifications (UML with Descriptions Streetlight Controller GPS Streetlight +getWeathero: double getLighto: double ??_getTraffic0. double getStreetLighto: double +setCommunication0: void Light Weather Communication Tratmic getLightO:double Motion Humidity Temperature SensorsExplanation / Answer
The instructions are in the comment along with the code
//code starts here
#include <iostream>
using namespace std;
int main(){
//generate a random temperature between 20 degree C to 40 degree C
int temp = rand()%20 + 20;
//generate a random humidity between 0 to 100%.
int humidity = rand()%101;
//status of the light
//There are three status of the light
//DIM. ON, and RED
//As mentioned in the question there is no time when light should be turned off
//It goes from DIM to ON or flicker RED
string light;
//We need to get the data fromt the motion sensor
//the data is represented as integer
//it is 0 if there is no motion for a certain period
//it is 1 if there is a pedestrian or a vehicle
//it is 2 if there is an ambulance
//we generate a random number between 0 to 2(inclusive)
int motion = rand()%3 ;
if(motion==0) light = "DIM";
if(motion==1) light = "ON";
if(motion==2) light = "RED";
cout<<light<<endl;
return 0;
}
//code ends here
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.