summaryrefslogtreecommitdiffstats
path: root/Bachelor/Prog1/Prakt6/prg1p6_1/mircowave.cpp
blob: 467a1b3982f23d4becf8398dff2e9d024adffd61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Programmieren 1, Praktikum 6, Aufgabe 1
// Author: Sven Eisenhauer
// Date: 13.01.2005
// File: mircowave.cpp
// Description: Implementation of class microwave

#include "microwave.h"
#include <iostream>

using std::cout;
using std::endl;

Microwave::Microwave(int vol)
{
	volume=vol;
	power=200;
	cout<<endl<<"Constructor class Mircowave";
}

Microwave::~Microwave()
{
	cout << endl << "Destructor class Mircowave: Power is " << getPower() << " Period is " << getPeriod();
}

void Microwave::morePower()
{
	if (getPower() <= 800)
		power+=200;
}
void Microwave::lessPower()
{
	if (getPower() >= 400)
		power-=200;
}

void Microwave::heatMeal(FrozenMeal &myMeal)
{
	double newTemp=myMeal.getTemperature()+((myMeal.getCoefficient()*getPower()*getPeriod())/myMeal.getVolume());
	if (myMeal.getVolume() <= volume)
		myMeal.changeTemperature(newTemp);
}