-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathship.cs
More file actions
50 lines (48 loc) · 1.04 KB
/
ship.cs
File metadata and controls
50 lines (48 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Broadsides
{
class Ship
{
private string type;
private int length;
private int hits;
private bool sunk;
public string Type
{
get { return this.type; }
set { this.type = value; }
}
public int Length
{
get { return this.length; }
set { this.length = value; }
}
public int Hits
{
get { return this.hits; }
set
{
this.hits = value;
if(this.hits == length)
{
this.sunk = true;
}
}
}
public bool Sunk
{
get { return this.sunk; }
}
public Ship(string Type, int Length)
{
type = Type;
length = Length;
hits = 0;
sunk = false;
}
}
}