using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace C_Sharp_Test
{
class Boiler
{
public const long MAxPressure = 2000;
public const long MINPressure = 500;
public Boiler()
{
pressure = (MAxPressure + MINPressure) / 2;
}
void Increase()
{
pressure++;
if (pressure > MAxPressure) throw new BoilerException("Too high pressure");
}
void Decrease()
{
pressure--;
if (pressure < MINPressure) throw new BoilerException("Too low pressure");
}
double pressure;
}
class BoilerException : Exception
{
public BoilerException()
: base()
{ }
public BoilerException(string message)
: base(message)
{ }
public BoilerException(string message, Exception innerException)
: base(message, innerException)
{ }
}
}
Comments
Leave a comment