This commit is contained in:
Rens Pastoor
2025-06-12 11:20:08 +02:00
parent 37013ec1fc
commit 1086760c4a
21 changed files with 444 additions and 256 deletions

View File

@@ -18,25 +18,57 @@ using System.Threading.Tasks;
using System.Xml.Linq;
namespace PoloClubApp {
internal class SmartWatch : Device, IWearable {
public string DeviceType = "Watch";
/// <summary>
/// Represents a smartwatch device that implements IWearable interface.
/// </summary>
public class SmartWatch : Device, IWearable {
/// <summary>
/// Gets the type of the device (always "SmartWatch").
/// </summary>
public string DeviceType { get; } = "SmartWatch";
/// <summary>
/// Gets the water resistance rating in meters.
/// </summary>
public int WaterResistanceMeters { get; }
/// <summary>
/// Gets the screen size in millimeters.
/// </summary>
public int ScreenSize { get; }
/// Initializes a new SmartWatch with specified ID, name, player name, water resistance, and screen size.
public SmartWatch(int id, string name, int waterResistanceMeters, int screenSize) : base(id, name, null){
WaterResistanceMeters = waterResistanceMeters;
ScreenSize = screenSize;
/// <summary>
/// Initializes a new instance of the SmartWatch class.
/// </summary>
/// <param name="id">The unique device identifier.</param>
/// <param name="name">The name of the smartwatch.</param>
/// <param name="waterResistanceMeters">Water resistance rating in meters.</param>
/// <param name="screenSize">Screen size in millimeters.</param>
public SmartWatch(int id, string name, int waterResistanceMeters, int screenSize)
: base(id, name)
{
WaterResistanceMeters = waterResistanceMeters;
ScreenSize = screenSize;
}
/// Returns a string representation of the SmartWatch details.
public override string GetDetails(){
return DeviceType + "Id: " + Id + ", Name: " + Name + ", WaterResistanceMeters: " + WaterResistanceMeters + ", ScreenSize: " + ScreenSize;
/// <summary>
/// Gets detailed information about the smartwatch.
/// </summary>
/// <returns>Formatted string with device details.</returns>
public override string GetDetails()
{
return $"{DeviceType} - Id: {Id}, Name: {Name}, " +
$"Water Resistance: {WaterResistanceMeters}m, " +
$"Screen Size: {ScreenSize}mm";
}
/// Returns the water resistance of the SmartWatch in meters.
public int GetWaterResistanceMeters(){
/// <summary>
/// Gets the water resistance rating.
/// </summary>
/// <returns>Water resistance in meters.</returns>
public int GetWaterResistanceMeters()
{
return WaterResistanceMeters;
}
}
}
}