Question: C++ apply settings and use to an oven. 4 Knob's; function (toast, broil, warm, bake), temperature(0 to 450degF), timer(0 to 60), toast(light, medium, dark). Able
C++ apply settings and use to an oven. 4 Knob's; function (toast, broil, warm, bake), temperature(0 to 450degF), timer(0 to 60), toast(light, medium, dark). Able to use the oven, place food in tray, then indicate when done (bell or light).
#include
#include
#include
using namespace std;
class FunctionK
{
public:
FunctionK() { function = Toast; }
string print() const
{
if (function == Broil)
return "Broil";
else if (function == Bake)
return "Bake";
else if (function == Toast)
return "Toast";
else
return "Warm";
}
FunctionK function;
};
class TempK
{
public:
TempK() { toast = Light; }
string print() const
{
if (toast == Light)
return "Light";
else if (toast == Medium)
return "Medium";
else
return "Dark";
}
};
class Tray
{
public:
Tray() { inUse = false; }
void setInUse(bool in) { inUse = in; }
bool getInUse() const { return inUse; }
bool inUse;
};
class Heat
{
public:
Heat() { temp = 0; isOn = false; }
void setTemp(int t) { temp = t; }
int getTemp() const { return temp; }
bool getIsOn() const { return isOn; }
void setIson(bool b) { isOn = b; }
int temp;
bool isOn;
};
class Degree
{
public:
Degree() {};
void command(vector
{
case Light:
h[0].setTemp(100);
t = 2;
break;
case Medium;
h[0].setTemp(300);
t = 3;
break;
case Dark;
h[0].setTemp(450);
t = 4;
break;
}
}
};
class Oven
{
public:
Oven() {}
Oven(Heat ht, Heat hb, Degree dg)
{
ovenHE.push_back(ht); ovenHE.push_back(hb);
ovenP = dg;
}
bool inFood()
{
if (status == "Ready")
{
if (doorClosed)
{
doorClosed = false;
doorClosed = true;
}
}
};
int main()
{
Heat ;
Degree ;
Oven ;
//food in tray and adjust settings
//bell ring if able
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
