cs and c
This commit is contained in:
@@ -17,27 +17,57 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PoloClubApp {
|
||||
internal class FitTracker : Device, IWearable {
|
||||
public string DeviceType = "FitTracker";
|
||||
public int Id { get; }
|
||||
public string Name { get; }
|
||||
public string PlayerName { get; set; }
|
||||
/// <summary>
|
||||
/// Represents a fitness tracker device that implements IWearable interface.
|
||||
/// </summary>
|
||||
public class FitTracker : Device, IWearable {
|
||||
/// <summary>
|
||||
/// Gets the type of the device (always "FitTracker").
|
||||
/// </summary>
|
||||
public string DeviceType { get; } = "FitTracker";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the water resistance rating in meters.
|
||||
/// </summary>
|
||||
public int WaterResistanceMeters { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the color of the fitness tracker.
|
||||
/// </summary>
|
||||
public string Color { get; }
|
||||
|
||||
public FitTracker(int id, string name, int waterResistanceMeters, string color) : base(id, name, null){
|
||||
Id = id;
|
||||
Name = name;
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the FitTracker class.
|
||||
/// </summary>
|
||||
/// <param name="id">The unique device identifier.</param>
|
||||
/// <param name="name">The name of the fitness tracker.</param>
|
||||
/// <param name="waterResistanceMeters">Water resistance rating in meters.</param>
|
||||
/// <param name="color">The color of the device.</param>
|
||||
public FitTracker(int id, string name, int waterResistanceMeters, string color)
|
||||
: base(id, name)
|
||||
{
|
||||
WaterResistanceMeters = waterResistanceMeters;
|
||||
Color = color;
|
||||
}
|
||||
|
||||
public override string GetDetails(){
|
||||
return DeviceType + "Id: " + Id + ", Name: " + Name + ", Type: " + ", WaterResistanceMeters: " + WaterResistanceMeters + ", Color: " + Color;
|
||||
/// <summary>
|
||||
/// Gets detailed information about the fitness tracker.
|
||||
/// </summary>
|
||||
/// <returns>Formatted string with device details.</returns>
|
||||
public override string GetDetails()
|
||||
{
|
||||
return $"{DeviceType} - Id: {Id}, Name: {Name}, " +
|
||||
$"Water Resistance: {WaterResistanceMeters}m, " +
|
||||
$"Color: {Color}";
|
||||
}
|
||||
|
||||
public int GetWaterResistanceMeters(){
|
||||
/// <summary>
|
||||
/// Gets the water resistance rating.
|
||||
/// </summary>
|
||||
/// <returns>Water resistance in meters.</returns>
|
||||
public int GetWaterResistanceMeters()
|
||||
{
|
||||
return WaterResistanceMeters;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user