/home/caleb/ASDV-Java/Semester 2/Assignments/lab3_CalebFontenot/src/main/java/com/calebfontenot/lab3_calebfontenot/Stock.java
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.calebfontenot.lab3_calebfontenot;

/**
 *
 * @author caleb
 */
public class Stock {
    
    private String symbol;
    private String name;
    private double previousClosingPrice;
    private double currentPrice;

    /**
     * Get the value of currentPrice
     *
     * @return the value of currentPrice
     */
    public double getCurrentPrice()
    {
        return currentPrice;
    }

    /**
     * Set the value of currentPrice
     *
     * @param currentPrice new value of currentPrice
     */
    public void setCurrentPrice(double currentPrice)
    {
        this.currentPrice = currentPrice;
    }

    
    /**
     * Get the value of previousClosingPrice
     *
     * @return the value of previousClosingPrice
     */
    public double getPreviousClosingPrice()
    {
        return previousClosingPrice;
    }

    /**
     * Set the value of previousClosingPrice
     *
     * @param previousClosingPrice new value of previousClosingPrice
     */
    public void setPreviousClosingPrice(double previousClosingPrice)
    {
        this.previousClosingPrice = previousClosingPrice;
    }


    /**
     * Get the value of name
     *
     * @return the value of name
     */
    public String getName()
    {
        return name;
    }

    /**
     * Set the value of name
     *
     * @param name new value of name
     */
    public void setName(String name)
    {
        this.name = name;
    }

    /**
     * Get the value of symbol
     *
     * @return the value of symbol
     */
    public String getSymbol()
    {
        return symbol;
    }

    /**
     * Set the value of symbol
     *
     * @param symbol new value of symbol
     */
    public void setSymbol(String symbol)
    {
        this.symbol = symbol;
    }

    public double getChangePercent() {
        return this.currentPrice - this.previousClosingPrice;
        //(((this.previousClosingPrice - this.currentPrice) / Math.abs(this.previousClosingPrice)) * 100)
    }

    @Override
    public String toString()
    {
        return "Stock{" + "symbol=" + symbol + ", name=" + name + ", previousClosingPrice=" + previousClosingPrice + ", currentPrice=" + currentPrice + "}"+ "\n" + "Change in Percent: " + this.getChangePercent();
    }
    public static void main(String[] args)
    {
        Stock stock1 = new Stock();
        stock1.setSymbol("ORCL");
        stock1.setName("Oracle Corporation");
        stock1.setPreviousClosingPrice(34.5);
        stock1.setCurrentPrice(34.35);
        System.out.println(stock1);
    }
}