<commit_before>/***************************************************************************
COSC 501
<NAME>
Lab 10
6 NOV 2013                                                  Due 11 NOV 2013
Problem:	Use a class to calculate price-change percentage of a given
			stock, like Google (GOOG)
Algorithm:	
***************************************************************************/

#include <iostream>
#include <string>
using namespace std;


class Stock
{
public:
	// default constructor
	Stock();
	// constructor
	Stock (string,string,double,double);
	// destructor
	~Stock();

	string getSymbol() const;
	string getName() const;
	double getPCP() const; //PCP = Previous Closing Price
	double getCP() const;

	double changePercent();

private:
	string symbol;
	string name;
	double previousClosingPrice;
	double currentPrice;

};
Stock::Stock()
{
	currentPrice = 0;
	previousClosingPrice = 0;
}
	
Stock::Stock(string symbolInput, string nameInput, double previousClosingPriceInput, double currentPriceInput)
{
	symbol = symbolInput;
	name = nameInput;
	previousClosingPrice = previousClosingPriceInput;
	currentPrice = currentPriceInput;
}

Stock::~Stock()
{

}

string Stock::getSymbol() const
{
	return symbol;
}

string Stock::getName() const
{
	return name;
}

double Stock::getPCP() const
{
	return previousClosingPrice;
}

double Stock::getCP() const
{
	return currentPrice;
}

double Stock::changePercent()
{
	return ((getCP() - getPCP()) / getPCP());
}


int main()
	{
		string symbolInput, nameInput;
		int previousClosingPriceInput, currentPriceInput;
		
		cout << "Enter the stock symbol: ";
		cin >> symbolInput;
		cout << "Enter the stock name: ";
		cin >> nameInput;
		cout << "Enter the previous price: ";
		cin >> previousClosingPriceInput;
		cout << "Enter the current price: ";
		cin >> currentPriceInput;

		Stock example1(symbolInput,nameInput,previousClosingPriceInput,currentPriceInput);

		cout << endl << "The price change percentage of stock " << example1.getSymbol()
			<< " - " << example1.getName() << " is " << example1.changePercent();
		
		
		return 0;
	}

// example: class constructor<commit_msg>Just have to format output a bit better<commit_after>/***************************************************************************
COSC 501
<NAME>
Lab 10
6 NOV 2013                                                  Due 11 NOV 2013
Problem:	Use a class to calculate price-change percentage of a given
			stock, like Google (GOOG)
Algorithm:	
***************************************************************************/

#include <iostream>
#include <string>
using namespace std;


class Stock
{
public:
	// default constructor
	Stock();
	// constructor
	Stock (string,string,double,double);
	// destructor
	~Stock();

	string getSymbol() const;
	string getName() const;
	double getPCP() const; //PCP = Previous Closing Price
	double getCP() const;

	double changePercent();

private:
	string symbol;
	string name;
	double previousClosingPrice;
	double currentPrice;

};
Stock::Stock()
{
	currentPrice = 0;
	previousClosingPrice = 0;
}
	
Stock::Stock(string symbolInput, string nameInput, double previousClosingPriceInput, double currentPriceInput)
{
	symbol = symbolInput;
	name = nameInput;
	previousClosingPrice = previousClosingPriceInput;
	currentPrice = currentPriceInput;
}

Stock::~Stock()
{

}

string Stock::getSymbol() const
{
	return symbol;
}

string Stock::getName() const
{
	return name;
}

double Stock::getPCP() const
{
	return previousClosingPrice;
}

double Stock::getCP() const
{
	return currentPrice;
}

double Stock::changePercent()
{
	return (((getCP() - getPCP()) / getPCP()) * 100);
}


int main()
	{
		string symbolInput, nameInput;
		int previousClosingPriceInput, currentPriceInput;
		
		cout << "Enter the stock symbol: ";
		cin >> symbolInput;
		cout << "Enter the stock name: ";
		cin >> nameInput;
		cout << "Enter the previous price: ";
		cin >> previousClosingPriceInput;
		cout << "Enter the current price: ";
		cin >> currentPriceInput;

		Stock example1(symbolInput,nameInput,previousClosingPriceInput,currentPriceInput);

		cout << endl << "The price change percentage of stock " << example1.getSymbol()
			<< " - " << example1.getName() << " is " << example1.changePercent() << "%\n";
		
		
		return 0;
	}

// example: class constructor
{'fraction_non_alphanumeric': 0.17980925796696906, 'fraction_numerical': 0.011397999534775528, 'mean_word_length': 4.368289637952559, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '579717', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1223, 'n_words': 362}