-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBikePart.cs
More file actions
58 lines (37 loc) · 1.3 KB
/
BikePart.cs
File metadata and controls
58 lines (37 loc) · 1.3 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
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BikePartManager
{
[Serializable]
public class BikePart
{
public string name { get; set; }
public string type { get; set; }
public string mfg { get; set; }
public string years { get; set; }
public double price { get; set;}
public double brkEven { get; set; }
public string display { get; set; }
public BikePart(string partName, string partType, string partMfg, string partYears, float partEbayPrice )
{
int spacesToAdd = 0;
for (int i =0; i < 20 - partName.Length; i++)
{
spacesToAdd += 1;
}
name = partName + String.Concat(Enumerable.Repeat(" ", spacesToAdd));
type = partType;
mfg = partMfg;
years = partYears;
price = Math.Round(partEbayPrice, 2);
display = String.Format("{0,-20}{1,-20}{2,-20}{3,-20}{4,-20}", name, type, mfg, years,"$"+price.ToString());
}
public void updateDisplay()
{
display = String.Format("{0,-20}{1,-20}{2,-20}{3,-20}{4,-20}", name, type, mfg, years, "$" + price.ToString());
}
}
}