From c702bcfd4fc6812e7868b9bfa226c1cac1608e8d Mon Sep 17 00:00:00 2001 From: Raphael Roberts Date: Tue, 11 Sep 2018 12:38:38 -0500 Subject: [PATCH] added files --- Stock.java | 19 +++++++++++++++++++ StockBroker.java | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 Stock.java create mode 100644 StockBroker.java diff --git a/Stock.java b/Stock.java new file mode 100644 index 0000000..beb5147 --- /dev/null +++ b/Stock.java @@ -0,0 +1,19 @@ +public class Stock{ + + public String name; + public String symbol; + public double openingPrice; + public double closingPrice; + + public void getChangeInPrice(){ + double change= closingPrice-openingPrice; + System.out.println("Change is" + change); + } + public void printStockInfo(){ + System.out.println("Name: " + name); + System.out.println("Symbol: " + symbol); + System.out.println("Opening Price: " + openingPrice); + System.out.println("Closing Price: "+ closingPrice); + + } +} \ No newline at end of file diff --git a/StockBroker.java b/StockBroker.java new file mode 100644 index 0000000..710adb6 --- /dev/null +++ b/StockBroker.java @@ -0,0 +1,18 @@ +public class StockBroker{ + public static void main(String[]args){ + Stock s1 = new Stock(); + Stock s2 = new Stock(); + + s1.name = "Oracle"; + s1.symbol = "ORCL"; + s1.openingPrice = 205.0; + s1.closingPrice = 203.0; + s2.name = "Microsoft"; + s2.symbol = "MCST"; + s2.openingPrice = 120.0; + s2.closingPrice = 125.0; + s1.printStockInfo(); + System.out.println(); + s2.printStockInfo(); + } +} \ No newline at end of file