Assignment No 1 of Data Structure Note - Attempt Al...
Assignment No 1 of Data Structure Note - Attempt Al...
home / study / engineering / computer science / computer science questions and answers /
assignment...
Answers
Anonymous
answered this
CODE :--
#include <iostream>
#include <string>
#include <vector>
class MilitaryTime
//Declare attributes
private:
int hours;
int minutes;
int seconds;
public:
//Meber functions
};
class Temperature
//Declare attributes
private:
int temp;
string label;
MilitaryTime time;
public:
//Member functions
};
// FUNCTION PROTOTYPES
MilitaryTime readTime();
int main()
// Declare constant
vector<Temperature> temps;
// Call the function in TASK 6
readTempData(temps, HIGHEST);
printTempSamples(temps);
printBarGraph(temps, HIGHEST);
getTimeLimit(temps);
return 0;
hours = hrs;
minutes = mins;
seconds = secs;
return hours;
return minutes;
}
int MilitaryTime::getSeconds() const
return seconds;
else
str += to_string(number);
return str;
+ ":" + twoDigits(seconds);
this->temp = tmp;
{
return this->temp;
this->label = lbl;
return this->label;
this->time.setHours(t.getHours());
this->time.setMinutes(t.getMinutes());
this->time.setSeconds(t.getSeconds());
return time;
+ time.toString();
//FUNCTION DEFINITIONS
int tempSample = 1;
Temperature t1;
while (true)
if (label.length() == 0)
break;
else
t1.setLabel(label);
t1.setTemp(getTemp(HIGHEST));
t1.setTime(getTime(temps));
temps.push_back(t1);
tempSample += 1;
cin.ignore();
string label;
getline(cin, label);
if (label.empty()) {
return label;
while (label.length() != 2 ||
!isUpper(label[0]) ||
!isUpper(label[1]) ||
isChoice(temps, label)) {
return label;
bool isUpper(char c) {
return isupper(c);
//temperature vector
{
if (temps[i].getLabel() == str)
return true;
return false;
int temp;
return temp;
time = readTime();
return time;
}
//Function definition of readTime: This function
MilitaryTime readTime()
MilitaryTime time;
time.setHours(hr);
time.setMinutes(min);
time.setSeconds(sec);
return time;
if (temps[i].getTime().toString() == time.toString())
return false;
return true;
while (true)
else
break;
0 Comments
COMPANY
CHEGG NETWORK
CUSTOMER SERVICE