i already did the other classes the temperature class i started and the streetli
ID: 3721487 • Letter: I
Question
i already did the other classes the temperature class i started and the streetlight will have the intensity and color of the light: #define _CRT_SECURE_NO_WARNINGS #define TEMPERATURE_RANGE 100 #include <iostream> #include <string> #include <cstdlib> #include <vector>using namespace std;
class Temperature { public: Temperature() { for (unsigned int i = 0; i < pTemperatureData.capacity(); i++) { pTemperatureData[i] = 0; } } //constructor
~Temperature() { for (unsigned int i = 0; i < pTemperatureData.size(); i++) { if (pTemperatureData[i]) { pTemperatureData[i] = 0; } } }//destructor
int getTemperatureData() { int randomData = rand() % TEMPERATURE_RANGE ; //random value generated from 0-100. This value is represented in Percentage if (randomData > 0) { pTemperatureData.push_back(randomData); //add randomData value into vector pLightData } return randomData; } void print() { for (unsigned int i = 0; i < pTemperatureData.size(); i++) { cout << pTemperatureData[i] << endl; } } static void test() { Temperature aTemperature; int randnum1 = aTemperature.getLightData(); int randnum2 = aTemperature.getLightData(); int randnum3 = aTemperature.getLightData(); int randnum4 = aTemperature.getLightData(); cout << "randnum1 = " << randnum1 << endl; cout << "randnum2 = " << randnum2 << endl; cout << "randnum3 = " << randnum3 << endl; cout << "randnum4 = " << randnum4 << endl; aTemperature.print(); } protected: vector <double> pTemperatureData; }; #define _CRT_SECURE_NO_WARNINGS #define TEMPERATURE_RANGE 100 #include <iostream> #include <string> #include <cstdlib> #include <vector>
using namespace std;
class Temperature { public: Temperature() { for (unsigned int i = 0; i < pTemperatureData.capacity(); i++) { pTemperatureData[i] = 0; } } //constructor
~Temperature() { for (unsigned int i = 0; i < pTemperatureData.size(); i++) { if (pTemperatureData[i]) { pTemperatureData[i] = 0; } } }//destructor
int getTemperatureData() { int randomData = rand() % TEMPERATURE_RANGE ; //random value generated from 0-100. This value is represented in Percentage if (randomData > 0) { pTemperatureData.push_back(randomData); //add randomData value into vector pLightData } return randomData; } void print() { for (unsigned int i = 0; i < pTemperatureData.size(); i++) { cout << pTemperatureData[i] << endl; } } static void test() { Temperature aTemperature; int randnum1 = aTemperature.getLightData(); int randnum2 = aTemperature.getLightData(); int randnum3 = aTemperature.getLightData(); int randnum4 = aTemperature.getLightData(); cout << "randnum1 = " << randnum1 << endl; cout << "randnum2 = " << randnum2 << endl; cout << "randnum3 = " << randnum3 << endl; cout << "randnum4 = " << randnum4 << endl; aTemperature.print(); } protected: vector <double> pTemperatureData; }; WhatsApp LTE 10:12 AM @?* 90%- Obiective: The light's goal is to help reduce light pollution and energy consumption while keeping the roads safe and visible ns 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 ap the smart streetlights LED light bulbs. propriate changes to The program will have three settings for the LED'S 1. light orn 2. light off 3. light dim These settings will depend on an analysis of the information the streetlight wl be able to pick up with Sensors that can detect 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 motio letector 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 given amount of time, the light will dim. Onc mode, the light will not be using up as much e
Explanation / Answer
#define _CRT_SECURE_NO_WARNINGS
#define TEMPERATURE_RANGE 100
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
using namespace std;
class Temperature
{
public:
Temperature()
{
for (unsigned int i = 0; i < pTemperatureData.capacity(); i++)
{
pTemperatureData[i] = 0;
}
} //constructor
~Temperature()
{
for (unsigned int i = 0; i < pTemperatureData.size(); i++)
{
if (pTemperatureData[i])
{
pTemperatureData[i] = 0;
}
}
}//destructor
int getTemperatureData()
{
int randomData = rand() % TEMPERATURE_RANGE ; //random value generated from 0-100. This value is represented in Percentage
if (randomData > 0)
{
pTemperatureData.push_back(randomData); //add randomData value into vector pLightData
}
return randomData;
}
void print()
{
for (unsigned int i = 0; i < pTemperatureData.size(); i++)
{
cout << pTemperatureData[i] << endl;
}
}
static void test()
{
Temperature aTemperature;
int randnum1 = aTemperature.getLightData();
int randnum2 = aTemperature.getLightData();
int randnum3 = aTemperature.getLightData();
int randnum4 = aTemperature.getLightData();
cout << "randnum1 = " << randnum1 << endl;
cout << "randnum2 = " << randnum2 << endl;
cout << "randnum3 = " << randnum3 << endl;
cout << "randnum4 = " << randnum4 << endl;
aTemperature.print();
}
protected:
vector <double> pTemperatureData;
};
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.