-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCompany.java
More file actions
180 lines (148 loc) · 4 KB
/
Company.java
File metadata and controls
180 lines (148 loc) · 4 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
public class Company
{
protected String companyName;
protected String companySymbol;
protected int year;
protected int firstQuarterRevenue;
protected int secondQuarterRevenue;
protected int thirdQuarterRevenue;
protected int fourthQuarterRevenue;
protected int yearlyRevenue;
protected int grossProfit;
protected int netIncome;
protected String date;
protected int averageVolume;
protected double stockPrice;
// Constructor
Company(String companyName, String companySymbol, int year, int firstQuarterRevenue, int secondQuarterRevenue, int thirdQuarterRevenue, int fourthQuarterRevenue, int grossProfit, int netIncome, String date, int averageVolume, double stockPrice)
{
this.companyName = companyName;
this.companySymbol = companySymbol;
this.year = year;
this.firstQuarterRevenue = firstQuarterRevenue;
this.secondQuarterRevenue = secondQuarterRevenue;
this.thirdQuarterRevenue = thirdQuarterRevenue;
this.fourthQuarterRevenue = fourthQuarterRevenue;
this.yearlyRevenue = 0;
this.grossProfit = grossProfit;
this.netIncome = netIncome;
this.date = date;
this.averageVolume = averageVolume;
this.stockPrice = stockPrice;
}
// Accessor
public String getCompanyName()
{
return companyName;
}
public String getCompanySymbol()
{
return companySymbol;
}
public int getYear()
{
return year;
}
public int getFirstQuarterRevenue()
{
return firstQuarterRevenue;
}
public int getSecondQuarterRevenue()
{
return secondQuarterRevenue;
}
public int getThirdQuarterRevenue()
{
return thirdQuarterRevenue;
}
public int getFourthQuarterRevenue()
{
return fourthQuarterRevenue;
}
public int getYearlyRevenue()
{
return yearlyRevenue;
}
public int getGrossProfit()
{
return grossProfit;
}
public int getNetIncome()
{
return netIncome;
}
public String getDate()
{
return date;
}
public int getAverageVolume()
{
return averageVolume;
}
public double getStockPrice()
{
return stockPrice;
}
// Mutator
public void setCompanyName(String companyName)
{
this.companyName = companyName;
}
public void setCompanySymbol(String companySymbol)
{
this.companySymbol = companySymbol;
}
public void setYear(int year)
{
this.year = year;
}
public void setFirstQuarterRevenue(int firstQuarterRevenue)
{
this.firstQuarterRevenue = firstQuarterRevenue;
}
public void setSecondQuarterRevenue(int secondQuarterRevenue)
{
this.secondQuarterRevenue = secondQuarterRevenue;
}
public void setThirdQuarterRevenue(int thirdQuarterRevenue)
{
this.thirdQuarterRevenue = thirdQuarterRevenue;
}
public void setFourthQuarterRevenue(int fourthQuarterRevenue)
{
this.fourthQuarterRevenue = fourthQuarterRevenue;
}
public void setYearlyRevenue(int yearlyRevenue)
{
this.yearlyRevenue = yearlyRevenue;
}
public void setGrossProfit(int grossProfit)
{
this.grossProfit = grossProfit;
}
public void setNetIncome(int netIncome)
{
this.netIncome = netIncome;
}
public void setDate(String date)
{
this.date = date;
}
public void setAverageVolume(int averageVolume)
{
this.averageVolume = averageVolume;
}
public void setStockPrice(double stockPrice)
{
this.stockPrice = stockPrice;
}
// Calculations
public void calculateYearlyRevenue()
{
this.yearlyRevenue = firstQuarterRevenue + secondQuarterRevenue + thirdQuarterRevenue + fourthQuarterRevenue;
}
public void calculateNewStockPrice(double percentChange)
{
this.stockPrice = ((percentChange + 100) / 100) * stockPrice;
}
}