Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

CSC-202 Assignment-3 Fall-2017 In this assignment you will be modifying the clas

ID: 3591194 • Letter: C

Question

CSC-202
Assignment-3
Fall-2017
In this assignment you will be modifying the class you created in assignment-1.
The first modification will be to add a new constructor that will accept three inputs,
1 the ticker symbol, 2 the Equity type (0 = stock, 1 = ETF , 2 = REIT ) and 3, total
number of shares held. The constructor will then do an internet call and use the
Yahoo Finance API to get information into the object. We will discuss in class the
example code posted that shows you how do to this.
Again you will use the same class you created in assignment 1 adding the new
constructor. You may have to add some new private variables and the
associated getters and setters.
The variables that you pass into the new constructor are
Ticker symbol of type string
Equity type of type integer (0 = stock, 1 = ETF , 2 = REIT )
Number of shares held of type integer.
The variables whose values will be set by retrieving the information over the
internet using the Yahoo Finance API are
Equity Name of type string – Yahoo Finance API flag - n
The Exchange of type string (NSYE, NASDQ, etc) - Yahoo Finance API flag - x
Current equity price of type float - Yahoo Finance API flag – b
Price at market open type float - Yahoo Finance API flag – o
Previous close price type float - Yahoo Finance API flag -p
Dividend yield in percent of type float - Yahoo Finance API flag - y
Dividend amount of type float. - Yahoo Finance API flag – d Note; not
calculated in this case.
Dividend pay rate type float - Yahoo Finance API flag – r1
Last trade date if type string - Yahoo Finance API flag – d1
Fifty two week high price float - Yahoo Finance API flag – k
Fifty two week low price float - Yahoo Finance API flag - j
Your main program will create an array of objects where each array element is
an instance of one of the equities.
Your main program should then use that array to generate the following report.
At the top of the report put our class “CSC-202 FAll 2017 Assignment-3 and your
name. The next line should be blank followed by a line that says Equity report
followed by a report that contains the following information for each equity in the
array.
Equity ticker symbol
Equity Name
Exchange the equity is traded on.
Equity Type ( Stock, ETF, or REIT)
Equity Current price
Equity price at the open
Previous close price.
52 week range High price – low price
Dividend yield
Dividend amount
Dividend pay rate
Last trade date (Format mm/dd/yyyy)
Number of shares held
Current value of shares held ( = Equity Current price * number of shares ).
Upload your source code (Equity class and main driver) for grading.

I have warnings and errors, and it will not print real time stock information please help!



import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;

/**
* Portfoliocalc class
*
*/
/**
* @author sagun
*
*/
public class Portfoliocalc {
// data members
private String tickerSymbol;
private String equityName;
private int numberOfSharesHeld;
private int equityType;
private String exchange;
private double currentEquityPrice;
private double priceAtMarketOpen;
private double estimatedYearlyPriceIncreasePercent;
private double dividendYieldPercent;
private double dividendPaymentCycle;
private double dividendAmount;
private double currentValueOfEquity;
private double equityAfterNYears;
private double previousClosePrice;
private String dividendPayRate;
private String lastTradeDate;
private double fiftyTwoWeekHighPrice;
private double fiftyTwoWeekLowPrice;

/**
* Constructor
*/
public Portfoliocalc() {

this.tickerSymbol = "N/A";
this.equityName = "N/A";
this.numberOfSharesHeld = -1;
this.equityType = -1;
this.exchange = "";
this.currentEquityPrice = -1;
this.setPriceAtMarketOpen(-1);
this.estimatedYearlyPriceIncreasePercent = -1;
this.dividendYieldPercent = -1;
this.dividendPaymentCycle = -1;

}

/**
* @param tickerSymbol
* @param equityName
* @param numberOfSharesHeld
* @param equityType
* @param exchange
* @param currentEquityPrice
* @param priceAtMarketOpen
* @param estimatedYearlyPriceIncreasePercent
* @param dividendYieldPercent
* @param dividendPaymentCycle
* @param dividendAmount
* @param currentValueOfEquity
* @param equityAfterNYears
* @param previousClosePrice
* @param dividendPayRate
* @param lastTradeDate
* @param fiftyTwoWeekHighPrice
* @param fiftyTwoWeekLowPrice
*/
public Portfoliocalc(String tickerSymbol, String equityName, int numberOfSharesHeld, int equityType,
String exchange, double currentEquityPrice, double priceAtMarketOpen,
double estimatedYearlyPriceIncreasePercent, double dividendYieldPercent, double dividendPaymentCycle,
double dividendAmount, double currentValueOfEquity, double equityAfterNYears, double previousClosePrice,
String dividendPayRate, String lastTradeDate, double fiftyTwoWeekHighPrice, double fiftyTwoWeekLowPrice) {
this.tickerSymbol = tickerSymbol;
this.equityName = equityName;
this.numberOfSharesHeld = numberOfSharesHeld;
this.equityType = equityType;
this.exchange = exchange;
this.currentEquityPrice = currentEquityPrice;
this.priceAtMarketOpen = priceAtMarketOpen;
this.estimatedYearlyPriceIncreasePercent = estimatedYearlyPriceIncreasePercent;
this.dividendYieldPercent = dividendYieldPercent;
this.dividendPaymentCycle = dividendPaymentCycle;
this.dividendAmount = dividendAmount;
this.currentValueOfEquity = currentValueOfEquity;
this.equityAfterNYears = equityAfterNYears;
this.previousClosePrice = previousClosePrice;
this.dividendPayRate = dividendPayRate;
this.lastTradeDate = lastTradeDate;
this.fiftyTwoWeekHighPrice = fiftyTwoWeekHighPrice;
this.fiftyTwoWeekLowPrice = fiftyTwoWeekLowPrice;
}

/**
* @param tickerSymbol
* @param equityType
* @param numberOfSharesHold
*/
public Portfoliocalc(String tickerSymbol, int equityType, int numberOfSharesHold) {
this.tickerSymbol = tickerSymbol;
this.equityType = equityType;
this.numberOfSharesHeld = numberOfSharesHold;
String queryURLString = "http://download.finance.yahoo.com/d/quotes.csv?s=" + tickerSymbol + "&f=nxbopydr1d1kj&e=.csv"; // query
// url
try {
URL queryURL = new URL(queryURLString);
HttpURLConnection con = (HttpURLConnection) queryURL.openConnection();
con.setRequestMethod("GET");
BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()));
String input;
String[] output;
input = reader.readLine();
// System.out.println(input);
output = input.split(",(?=([^"]*"[^"]*")*[^"]*$)", -1);
this.equityName = output[0];
this.exchange = output[1];
this.currentEquityPrice = Double.parseDouble(output[2]);
this.setPriceAtMarketOpen(Double.parseDouble(output[3]));
this.setPreviousClosePrice(Double.parseDouble(output[4]));
this.dividendYieldPercent = Double.parseDouble(output[5]);
this.dividendAmount = Double.parseDouble(output[6]);
this.setDividendPayRate(output[7]);
this.setLastTradeDate(output[8]);
this.setFiftyTwoWeekHighPrice(Double.parseDouble(output[9]));
this.setFiftyTwoWeekLowPrice(Double.parseDouble(output[10]));
reader.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

/**
* @return ticker symbol
*/
public String getTickerSymbol() {
return tickerSymbol;
}

/**
* @return equity name
*/
public String getEquityName() {
return equityName;
}

/**
* @return number of shares hold
*/
public int getNumberOfSharesHeld() {
return numberOfSharesHeld;
}

/**
* @return equity type
*/
public int getEquityType() {
return equityType;
}

/**
* @return exchage name
*/
public String getExchange() {
return exchange;
}

/**
* @return current equity price
*/
public double getCurrentEquityPrice() {
return currentEquityPrice;
}

/**
* @return Estimated Yearly Price Increase Percent
*/
public double getEstimatedYearlyPriceIncreasePercent()

{
return estimatedYearlyPriceIncreasePercent;
}

/**
* @return Dividend Yield Percent
*/
public double getDividendYieldPercent() {
return dividendYieldPercent;
}

/**
* @return Dividend Payment Cycle
*/
public double getDividendPaymentCycle() {
return dividendPaymentCycle;
}

/**
* @return Dividend Amount
*/
public double getDividendAmount() {
return dividendAmount;
}

/**
* @return Current Value Of Equity
*/
public double getCurrentValueOfEquity() {
calculateCurrentValueOfEquity();
return currentValueOfEquity;
}

/**
* @return Equity After N Years
*/
public double getEquityAfterNYears() {
return equityAfterNYears;
}

/**
* @param tickerSymbol
*/
public void setTicketSymbol(String tickerSymbol) {
this.tickerSymbol = tickerSymbol;
}

/**
* @param equityName
*/
public void setEquityName(String equityName) {
this.equityName = equityName;
}

/**
* @param numberOfSharesHeld
*/
public void setNumberOfSharesHeld(int numberOfSharesHeld) {
this.numberOfSharesHeld = numberOfSharesHeld;
}

/**
* @param equityType
*/
public void setEquityType(int equityType) {
this.equityType = equityType;
}

/**
* @param exchange
*/
public void setExchange(String exchange) {
this.exchange = exchange;
}

/**
* @param currentEquityPrice
*/
public void setCurrentEquityPrice(double currentEquityPrice) {
this.currentEquityPrice = currentEquityPrice;
}

/**
* @param estimatedYearlyPriceIncreasePercent
*/
public void setEstimatedYearlyPriceIncreasePercent(double estimatedYearlyPriceIncreasePercent) {
this.estimatedYearlyPriceIncreasePercent = estimatedYearlyPriceIncreasePercent;
}

/**
* @param dividendYieldPercent
*/
public void setDividendPercent(double dividendYieldPercent) {
this.dividendYieldPercent = dividendYieldPercent;
}

/**
* @param dividendPaymentCycle
*/
public void setDividendPaymentCycle(double dividendPaymentCycle) {
this.dividendPaymentCycle = dividendPaymentCycle;
}

/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
public String toString() {
String result = "";
result += "Equity ticker symbol : " + getTickerSymbol() + " ";
result += "Equity name : " + getEquityName() + " ";
result += "Number of shares held : " + getNumberOfSharesHeld() + " ";
result += "Current price per share : " + getCurrentEquityPrice() + " ";
result += "Calculated current value : " + getCurrentValueOfEquity() + " ";
return result;
}

/**
* calculate current value of equity
*/
@SuppressWarnings("unused")
private void calculateCurrentValueOfEquity() {
currentValueOfEquity = getCurrentEquityPrice() * getNumberOfSharesHeld();
}

/**
* calculate dividend amount
*/
@SuppressWarnings("unused")
private void calculateDividendAmount() {
dividendAmount = (getCurrentEquityPrice() * getDividendYieldPercent()) / getDividendPaymentCycle();
}

/**
* calculate equity amount after N years.
*/
public void calculateEquityAfterNYears() {
equityAfterNYears = getCurrentEquityPrice();
for (int i = 1; i < dividendPaymentCycle; i++) {
equityAfterNYears += equityAfterNYears * estimatedYearlyPriceIncreasePercent;
}
}

/**
* @return the priceAtMarketOpen
*/
public double getPriceAtMarketOpen() {
return priceAtMarketOpen;
}

/**
* @param priceAtMarketOpen
* the priceAtMarketOpen to set
*/
public void setPriceAtMarketOpen(double priceAtMarketOpen) {
this.priceAtMarketOpen = priceAtMarketOpen;
}

/**
* @return the previousClosePrice
*/
public double getPreviousClosePrice() {
return previousClosePrice;
}

/**
* @param previousClosePrice
* the previousClosePrice to set
*/
public void setPreviousClosePrice(double previousClosePrice) {
this.previousClosePrice = previousClosePrice;
}

/**
* @return the dividendPayRate
*/
public String getDividendPayRate() {
return dividendPayRate;
}

/**
* @param dividendPayRate
* the dividendPayRate to set
*/
public void setDividendPayRate(String dividendPayRate) {
this.dividendPayRate = dividendPayRate;
}

/**
* @return the lastTradeDate
*/
public String getLastTradeDate() {
return lastTradeDate;
}

/**
* @param lastTradeDate
* the lastTradeDate to set
*/
public void setLastTradeDate(String lastTradeDate) {
this.lastTradeDate = lastTradeDate;
}

/**
* @return the fiftyTwoWeekHighPrice
*/
public double getFiftyTwoWeekHighPrice() {
return fiftyTwoWeekHighPrice;
}

/**
* @param fiftyTwoWeekHighPrice
* the fiftyTwoWeekHighPrice to set
*/
public void setFiftyTwoWeekHighPrice(double fiftyTwoWeekHighPrice) {
this.fiftyTwoWeekHighPrice = fiftyTwoWeekHighPrice;
}

/**
* @return the fiftyTwoWeekLowPrice
*/
public double getFiftyTwoWeekLowPrice() {
return fiftyTwoWeekLowPrice;
}

/**
* @param fiftyTwoWeekLowPrice
* the fiftyTwoWeekLowPrice to set
*/
public void setFiftyTwoWeekLowPrice(double fiftyTwoWeekLowPrice) {
this.fiftyTwoWeekLowPrice = fiftyTwoWeekLowPrice;
}
}

----------------------------------------------------------

/**
*
*/

/**
* Portfolio class
*
*/
public class Portfolio {
public static void main(String[] args) {
System.out.println("Fabiana Delgadillo");
System.out.println("CSC 202");
System.out.println("EQUITY REPORT");
System.out.println("");

Portfoliocalc p1 = new Portfoliocalc("XOM", 0, 200);

Portfoliocalc p2 = new Portfoliocalc("D", 0, 50);

Portfoliocalc p3 = new Portfoliocalc("O", 2, 100);

Portfoliocalc p4 = new Portfoliocalc("XLU", 1, 250);

Portfoliocalc p5 = new Portfoliocalc("AAPL", 0, 100);

Portfoliocalc[] portfolios = { p1, p2, p3, p4, p5 };

for (int i = 0; i < portfolios.length; i++) {
printPortfolio(portfolios[i]);
}
}

public static void printPortfolio(Portfoliocalc p) {
System.out.println("Equity ticker symbol :" + p.getTickerSymbol());
System.out.println("Equity name :" + p.getEquityName());
System.out.println("Exchange :" + p.getExchange());
System.out.println("Equity type :" + p.getEquityType());
System.out.println("Equity Current price :" + p.getCurrentEquityPrice());
System.out.println("Price at open :" + p.getPriceAtMarketOpen());
System.out.println("Previous close price :" + p.getPreviousClosePrice());
System.out.println("52 week range :" + p.getFiftyTwoWeekHighPrice() + "-" + p.getFiftyTwoWeekLowPrice());
System.out.println("Dividend yield :" + p.getDividendYieldPercent());
System.out.println("Dividend amount :" + p.getDividendAmount());
System.out.println("Dividend pay rate :" + p.getDividendPayRate());
System.out.println("Last trade date :" + p.getLastTradeDate());
System.out.println("Number of shares held :" + p.getNumberOfSharesHeld());
System.out.println("Current value of shares held :" + p.getCurrentValueOfEquity());
System.out.println();
}
}

Use this website for Yahoo API

Yahoo finance api documentation

https://github.com/mxbi/yahoo-finance-api/blob/master/DOCUMENTATION.md

Explanation / Answer

I changed the flag to get current price to l1 instead of using b.

I am unable to get the values of XLU though. Not sure if its because market is closed. The open, high, low and close are all coming as N/A.

"SPDR Select Sector Fund - Utili","PCX",54.53,N/A,54.25,N/A,N/A,N/A,"10/12/2017",55.90,45.33

So I just commentd out the XLU part and ran the code. The output is shown below. Please test your code when the markets are open.

/**

*

*/

/**

* Portfolio class

*

*/

public class Portfolio {

   public static void main(String[] args) {

   System.out.println("Fabiana Delgadillo");

   System.out.println("CSC 202");

   System.out.println("EQUITY REPORT");

   System.out.println("");

   Portfoliocalc p1 = new Portfoliocalc("XOM", 0, 200);

   Portfoliocalc p2 = new Portfoliocalc("D", 0, 50);

   Portfoliocalc p3 = new Portfoliocalc("O", 2, 100);

   //Portfoliocalc p4 = new Portfoliocalc("XLU", 1, 250);

   Portfoliocalc p5 = new Portfoliocalc("AAPL", 0, 100);

   Portfoliocalc[] portfolios = { p1, p2, p3,/* p4,*/ p5 };

   for (int i = 0; i < portfolios.length; i++) {

   printPortfolio(portfolios[i]);

   }

   }

   public static void printPortfolio(Portfoliocalc p) {

   System.out.println("Equity ticker symbol :" + p.getTickerSymbol());

   System.out.println("Equity name :" + p.getEquityName());

   System.out.println("Exchange :" + p.getExchange());

   System.out.println("Equity type :" + p.getEquityType());

   System.out.println("Equity Current price :" + p.getCurrentEquityPrice());

   System.out.println("Price at open :" + p.getPriceAtMarketOpen());

   System.out.println("Previous close price :" + p.getPreviousClosePrice());

   System.out.println("52 week range :" + p.getFiftyTwoWeekHighPrice() + "-" + p.getFiftyTwoWeekLowPrice());

   System.out.println("Dividend yield :" + p.getDividendYieldPercent());

   System.out.println("Dividend amount :" + p.getDividendAmount());

   System.out.println("Dividend pay rate :" + p.getDividendPayRate());

   System.out.println("Last trade date :" + p.getLastTradeDate());

   System.out.println("Number of shares held :" + p.getNumberOfSharesHeld());

   System.out.println("Current value of shares held :" + p.getCurrentValueOfEquity());

   System.out.println();

   }

}

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
/**
* Portfoliocalc class
*
*/
/**
* @author sagun
*
*/
public class Portfoliocalc {
// data members
private String tickerSymbol;
private String equityName;
private int numberOfSharesHeld;
private int equityType;
private String exchange;
private double currentEquityPrice;
private double priceAtMarketOpen;
private double estimatedYearlyPriceIncreasePercent;
private double dividendYieldPercent;
private double dividendPaymentCycle;
private double dividendAmount;
private double currentValueOfEquity;
private double equityAfterNYears;
private double previousClosePrice;
private String dividendPayRate;
private String lastTradeDate;
private double fiftyTwoWeekHighPrice;
private double fiftyTwoWeekLowPrice;
/**
* Constructor
*/
public Portfoliocalc() {
this.tickerSymbol = "N/A";
this.equityName = "N/A";
this.numberOfSharesHeld = -1;
this.equityType = -1;
this.exchange = "";
this.currentEquityPrice = -1;
this.setPriceAtMarketOpen(-1);
this.estimatedYearlyPriceIncreasePercent = -1;
this.dividendYieldPercent = -1;
this.dividendPaymentCycle = -1;
}
/**
* @param tickerSymbol
* @param equityName
* @param numberOfSharesHeld
* @param equityType
* @param exchange
* @param currentEquityPrice
* @param priceAtMarketOpen
* @param estimatedYearlyPriceIncreasePercent
* @param dividendYieldPercent
* @param dividendPaymentCycle
* @param dividendAmount
* @param currentValueOfEquity
* @param equityAfterNYears
* @param previousClosePrice
* @param dividendPayRate
* @param lastTradeDate
* @param fiftyTwoWeekHighPrice
* @param fiftyTwoWeekLowPrice
*/
public Portfoliocalc(String tickerSymbol, String equityName, int numberOfSharesHeld, int equityType,
String exchange, double currentEquityPrice, double priceAtMarketOpen,
double estimatedYearlyPriceIncreasePercent, double dividendYieldPercent, double dividendPaymentCycle,
double dividendAmount, double currentValueOfEquity, double equityAfterNYears, double previousClosePrice,
String dividendPayRate, String lastTradeDate, double fiftyTwoWeekHighPrice, double fiftyTwoWeekLowPrice) {
this.tickerSymbol = tickerSymbol;
this.equityName = equityName;
this.numberOfSharesHeld = numberOfSharesHeld;
this.equityType = equityType;
this.exchange = exchange;
this.currentEquityPrice = currentEquityPrice;
this.priceAtMarketOpen = priceAtMarketOpen;
this.estimatedYearlyPriceIncreasePercent = estimatedYearlyPriceIncreasePercent;
this.dividendYieldPercent = dividendYieldPercent;
this.dividendPaymentCycle = dividendPaymentCycle;
this.dividendAmount = dividendAmount;
this.currentValueOfEquity = currentValueOfEquity;
this.equityAfterNYears = equityAfterNYears;
this.previousClosePrice = previousClosePrice;
this.dividendPayRate = dividendPayRate;
this.lastTradeDate = lastTradeDate;
this.fiftyTwoWeekHighPrice = fiftyTwoWeekHighPrice;
this.fiftyTwoWeekLowPrice = fiftyTwoWeekLowPrice;
}
/**
* @param tickerSymbol
* @param equityType
* @param numberOfSharesHold
*/
public Portfoliocalc(String tickerSymbol, int equityType, int numberOfSharesHold) {
this.tickerSymbol = tickerSymbol;
this.equityType = equityType;
this.numberOfSharesHeld = numberOfSharesHold;
String queryURLString = "http://download.finance.yahoo.com/d/quotes.csv?s=" + tickerSymbol + "&f=nxl1opydr1d1kj&e=.csv"; // query
// url
try {
URL queryURL = new URL(queryURLString);
HttpURLConnection con = (HttpURLConnection) queryURL.openConnection();
con.setRequestMethod("GET");
BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()));
String input;
String[] output;
input = reader.readLine();
// System.out.println(input);
output = input.split(",(?=([^"]*"[^"]*")*[^"]*$)", -1);
this.equityName = output[0];
this.exchange = output[1];
this.currentEquityPrice = Double.parseDouble(output[2]);
this.setPriceAtMarketOpen(Double.parseDouble(output[3]));
this.setPreviousClosePrice(Double.parseDouble(output[4]));
this.dividendYieldPercent = Double.parseDouble(output[5]);
this.dividendAmount = Double.parseDouble(output[6]);
this.setDividendPayRate(output[7]);
this.setLastTradeDate(output[8]);
this.setFiftyTwoWeekHighPrice(Double.parseDouble(output[9]));
this.setFiftyTwoWeekLowPrice(Double.parseDouble(output[10]));
reader.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/**
* @return ticker symbol
*/
public String getTickerSymbol() {
return tickerSymbol;
}
/**
* @return equity name
*/
public String getEquityName() {
return equityName;
}
/**
* @return number of shares hold
*/
public int getNumberOfSharesHeld() {
return numberOfSharesHeld;
}
/**
* @return equity type
*/
public int getEquityType() {
return equityType;
}
/**
* @return exchage name
*/
public String getExchange() {
return exchange;
}
/**
* @return current equity price
*/
public double getCurrentEquityPrice() {
return currentEquityPrice;
}
/**
* @return Estimated Yearly Price Increase Percent
*/
public double getEstimatedYearlyPriceIncreasePercent()
{
return estimatedYearlyPriceIncreasePercent;
}
/**
* @return Dividend Yield Percent
*/
public double getDividendYieldPercent() {
return dividendYieldPercent;
}
/**
* @return Dividend Payment Cycle
*/
public double getDividendPaymentCycle() {
return dividendPaymentCycle;
}
/**
* @return Dividend Amount
*/
public double getDividendAmount() {
return dividendAmount;
}
/**
* @return Current Value Of Equity
*/
public double getCurrentValueOfEquity() {
calculateCurrentValueOfEquity();
return currentValueOfEquity;
}
/**
* @return Equity After N Years
*/
public double getEquityAfterNYears() {
return equityAfterNYears;
}
/**
* @param tickerSymbol
*/
public void setTicketSymbol(String tickerSymbol) {
this.tickerSymbol = tickerSymbol;
}
/**
* @param equityName
*/
public void setEquityName(String equityName) {
this.equityName = equityName;
}
/**
* @param numberOfSharesHeld
*/
public void setNumberOfSharesHeld(int numberOfSharesHeld) {
this.numberOfSharesHeld = numberOfSharesHeld;
}
/**
* @param equityType
*/
public void setEquityType(int equityType) {
this.equityType = equityType;
}
/**
* @param exchange
*/
public void setExchange(String exchange) {
this.exchange = exchange;
}
/**
* @param currentEquityPrice
*/
public void setCurrentEquityPrice(double currentEquityPrice) {
this.currentEquityPrice = currentEquityPrice;
}
/**
* @param estimatedYearlyPriceIncreasePercent
*/
public void setEstimatedYearlyPriceIncreasePercent(double estimatedYearlyPriceIncreasePercent) {
this.estimatedYearlyPriceIncreasePercent = estimatedYearlyPriceIncreasePercent;
}
/**
* @param dividendYieldPercent
*/
public void setDividendPercent(double dividendYieldPercent) {
this.dividendYieldPercent = dividendYieldPercent;
}
/**
* @param dividendPaymentCycle
*/
public void setDividendPaymentCycle(double dividendPaymentCycle) {
this.dividendPaymentCycle = dividendPaymentCycle;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
public String toString() {
String result = "";
result += "Equity ticker symbol : " + getTickerSymbol() + " ";
result += "Equity name : " + getEquityName() + " ";
result += "Number of shares held : " + getNumberOfSharesHeld() + " ";
result += "Current price per share : " + getCurrentEquityPrice() + " ";
result += "Calculated current value : " + getCurrentValueOfEquity() + " ";
return result;
}
/**
* calculate current value of equity
*/
@SuppressWarnings("unused")
private void calculateCurrentValueOfEquity() {
currentValueOfEquity = getCurrentEquityPrice() * getNumberOfSharesHeld();
}
/**
* calculate dividend amount
*/
@SuppressWarnings("unused")
private void calculateDividendAmount() {
dividendAmount = (getCurrentEquityPrice() * getDividendYieldPercent()) / getDividendPaymentCycle();
}
/**
* calculate equity amount after N years.
*/
public void calculateEquityAfterNYears() {
equityAfterNYears = getCurrentEquityPrice();
for (int i = 1; i < dividendPaymentCycle; i++) {
equityAfterNYears += equityAfterNYears * estimatedYearlyPriceIncreasePercent;
}
}
/**
* @return the priceAtMarketOpen
*/
public double getPriceAtMarketOpen() {
return priceAtMarketOpen;
}
/**
* @param priceAtMarketOpen
* the priceAtMarketOpen to set
*/
public void setPriceAtMarketOpen(double priceAtMarketOpen) {
this.priceAtMarketOpen = priceAtMarketOpen;
}
/**
* @return the previousClosePrice
*/
public double getPreviousClosePrice() {
return previousClosePrice;
}
/**
* @param previousClosePrice
* the previousClosePrice to set
*/
public void setPreviousClosePrice(double previousClosePrice) {
this.previousClosePrice = previousClosePrice;
}
/**
* @return the dividendPayRate
*/
public String getDividendPayRate() {
return dividendPayRate;
}
/**
* @param dividendPayRate
* the dividendPayRate to set
*/
public void setDividendPayRate(String dividendPayRate) {
this.dividendPayRate = dividendPayRate;
}
/**
* @return the lastTradeDate
*/
public String getLastTradeDate() {
return lastTradeDate;
}
/**
* @param lastTradeDate
* the lastTradeDate to set
*/
public void setLastTradeDate(String lastTradeDate) {
this.lastTradeDate = lastTradeDate;
}
/**
* @return the fiftyTwoWeekHighPrice
*/
public double getFiftyTwoWeekHighPrice() {
return fiftyTwoWeekHighPrice;
}
/**
* @param fiftyTwoWeekHighPrice
* the fiftyTwoWeekHighPrice to set
*/
public void setFiftyTwoWeekHighPrice(double fiftyTwoWeekHighPrice) {
this.fiftyTwoWeekHighPrice = fiftyTwoWeekHighPrice;
}
/**
* @return the fiftyTwoWeekLowPrice
*/
public double getFiftyTwoWeekLowPrice() {
return fiftyTwoWeekLowPrice;
}
/**
* @param fiftyTwoWeekLowPrice
* the fiftyTwoWeekLowPrice to set
*/
public void setFiftyTwoWeekLowPrice(double fiftyTwoWeekLowPrice) {
this.fiftyTwoWeekLowPrice = fiftyTwoWeekLowPrice;
}
}



Fabiana Delgadillo
CSC 202
EQUITY REPORT
Equity ticker symbol :XOM
Equity name :"Exxon Mobil Corporation"
Exchange :"NYQ"
Equity type :0
Equity Current price :82.43
Price at open :82.31
Previous close price :82.6
52 week range :93.22-76.05
Dividend yield :3.85
Dividend amount :3.08
Dividend pay rate :"9/11/2017"
Last trade date :"10/12/2017"
Number of shares held :200
Current value of shares held :16486.0
Equity ticker symbol :D
Equity name :"Dominion Energy, Inc."
Exchange :"NYQ"
Equity type :0
Equity Current price :78.63
Price at open :77.91
Previous close price :78.01
52 week range :81.65-69.51
Dividend yield :3.88
Dividend amount :3.02
Dividend pay rate :"9/20/2017"
Last trade date :"10/12/2017"
Number of shares held :50
Current value of shares held :3931.5
Equity ticker symbol :O
Equity name :"Realty Income Corporation"
Exchange :"NYQ"
Equity type :2
Equity Current price :56.75
Price at open :56.65
Previous close price :56.67
52 week range :63.6-52.72
Dividend yield :4.42
Dividend amount :2.54
Dividend pay rate :"10/13/2017"
Last trade date :"10/12/2017"
Number of shares held :100
Current value of shares held :5675.0
Equity ticker symbol :AAPL
Equity name :"Apple Inc."
Exchange :"NMS"
Equity type :0
Equity Current price :156.0
Price at open :156.35
Previous close price :156.55
52 week range :164.94-104.08
Dividend yield :1.62
Dividend amount :2.52
Dividend pay rate :"8/17/2017"
Last trade date :"10/12/2017"
Number of shares held :100
Current value of shares held :15600.0