Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MobilePhoneDevice
- {
- class Battery
- {
- private string model;
- private double hoursIdle = 4d; // !
- private double hoursTalk = 0.5d; // !
- public BatteryType BatteryType { get; set; }
- //property for model
- public string Model
- {
- get
- {
- return this.model;
- }
- private set // ????
- {
- this.model = value;
- }
- }
- //property for hours idle
- public double HoursIdle
- {
- get { return this.hoursIdle; }
- private set // ????
- {
- this.hoursIdle = value;
- if (value < 0.0)
- {
- throw new ArgumentException();
- }
- }
- }
- //property for hours talk
- public double HoursTalk
- {
- get { return this.hoursTalk; }
- private set // ????
- {
- this.hoursTalk = value;
- }
- }
- //no default contructor
- //public Battery()
- //{
- //}
- //constructor
- public Battery(string model):this(model, 4,0.5,BatteryType.Liion)
- {
- }
- //constructor
- public Battery(string model, double hoursTalk):this(model,4.0,hoursTalk,BatteryType.Liion)
- {
- }
- //constructor
- public Battery(string model, double hoursIdle, double hoursTalk,BatteryType batteryType)
- {
- this.model = model;
- this.hoursIdle = hoursIdle;
- if (hoursIdle<0)
- {
- throw new ArgumentException();
- }
- this.hoursTalk = hoursTalk;
- if (hoursTalk<0)
- {
- throw new ArgumentException();
- }
- this.BatteryType = batteryType;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement