Created
April 16, 2012 16:55
-
-
Save codewithcats/2399947 to your computer and use it in GitHub Desktop.
Team 1 Lv 1: Src
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ECal.Core | |
{ | |
public class Device | |
{ | |
private string name; | |
private double power; | |
private double duration; | |
public Device() | |
{ | |
name = "device"; | |
power = 100.00; | |
duration = 1.00; | |
} | |
public string Name | |
{ | |
get { return name; } | |
set | |
{ | |
if (value == "" || value == null) | |
{ throw new Exception(); } | |
else | |
{ | |
this.name = value; | |
} | |
} | |
} | |
public double Power | |
{ | |
get { return power; } | |
set | |
{ | |
if (value > 0.00 && value <= 10000.00) | |
{ this.power = value; } | |
else | |
{ | |
throw new Exception(); | |
} | |
} | |
} | |
public double Duration | |
{ | |
get { return duration; } | |
set | |
{ | |
if (value > 0.00 && value <= 24.00) | |
{ this.duration = value; } | |
else { throw new Exception(); } | |
} | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace ECal.Core | |
{ | |
public class Device | |
{ | |
private string Name; | |
private double Power; | |
public double Duration { get; set; } | |
public Device() | |
{ | |
Name = "device"; | |
Power = 100.00; | |
Duration = 1.00; | |
} | |
public void setName(string name) | |
{ | |
if (name == "" || name == null) | |
{ throw new Exception(); } | |
else | |
{ | |
Name = name; | |
} | |
} | |
public object getName() | |
{ | |
return Name; | |
} | |
public double getPower() | |
{ | |
return Power; | |
} | |
public void setDuration(double duration) | |
{ | |
if (duration > 0.00 && duration <= 24.00) | |
{ Duration = duration; } | |
else { throw new Exception(); } | |
} | |
public void setPower(double power) | |
{ | |
if (power > 0.00 && power <= 10000.00) | |
{ Power = power; } | |
else { throw new Exception(); } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment