74 lines
2.4 KiB
C#
74 lines
2.4 KiB
C#
///
|
|
/// class: SmartWatch.cs
|
|
///
|
|
///This file defines the SmartWatch class, which represents a smartwatch device. It implements the IWearable interface
|
|
///and includes properties for water resistance and screen size, along with methods to get device details.
|
|
///
|
|
/// Name: Rens Pastoor
|
|
/// Studentnumber: 555408
|
|
/// Date: 11 May 2025
|
|
///
|
|
///Version: 1
|
|
///
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Xml.Linq;
|
|
|
|
namespace PoloClubApp {
|
|
/// <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; }
|
|
|
|
/// <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;
|
|
}
|
|
|
|
/// <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";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the water resistance rating.
|
|
/// </summary>
|
|
/// <returns>Water resistance in meters.</returns>
|
|
public int GetWaterResistanceMeters()
|
|
{
|
|
return WaterResistanceMeters;
|
|
}
|
|
}
|
|
} |