-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStock.cs
More file actions
38 lines (34 loc) · 1.01 KB
/
Stock.cs
File metadata and controls
38 lines (34 loc) · 1.01 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
using System;
using System.Collections.Generic;
using System.Text;
namespace Assignment_2
{
public class Stock
{
public string Symbol { get; set; }
public string Name { get; set; }
public decimal Holdings { get; set; }
public decimal CurrentPrice { get; set; }
// default constructor
public Stock()
{
Symbol = "NA";
Name = "Invalid";
Holdings = 0;
CurrentPrice = -99;
}
// Constructor for initialization
public Stock(string symbol, string name, decimal holdings, decimal currentPrice)
{
Symbol = symbol;
Name = name;
Holdings = holdings;
CurrentPrice = currentPrice;
}
// overridden ToString method to customize the return value
public override string ToString()
{
return Symbol + ", " + Name + ", " + Holdings + ", " + CurrentPrice;
}
}
}