using System; class Resistor { double R; double maxP; public Resistor(double R, double maxP) { this.R = R; this.maxP=maxP; } public double GetCurrent(double U) { return U / R; } public double GetPower(double U) { return GetCurrent(U) * U; } public bool IsAllowedVoltage(double U){ if(GetPower(U)>maxP){return false;} return true; } } public class ResistorRun4 { public static void Main(String[] args) { Resistor R1 = new Resistor(220, 0.5); Console.WriteLine(R1.GetPower(5)); Console.WriteLine(R1.IsAllowedVoltage(5)); Console.WriteLine(R1.IsAllowedVoltage(50)); } }