Question: 2. Class definition #2 Write a program which defines a class for appliances. The class should have three properties the device name, the power consumption,
2. Class definition \#2 Write a program which defines a class for appliances. The class should have three properties the device name, the power consumption, and the energy efficiency expressed as a percentage. The device name is a mandatory property, while the other two are optional and, therefore, can have a default value (eg, 1 for 1 Watt and 50 for an efficiency of 50% ). Create 2 objects using the defined class. Provide the code below. Now, make sure that all parameters are hidden and allow their retrieval with a getter method and their modification with a setter method. Modify and display the properties of the two previously created objects. Provide the code below. Create a method that provides the power losses as the product between the power consumption and the complement to 1 of the efficiency: power_losses = power_consuption * (100-efficlency) /100) In the previous code, use the method for calculating power losses for the two previously created objects. Provide the code below
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
