You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
526 B

7 years ago
  1. public class Stock{
  2. public String name;
  3. public String symbol;
  4. public double openingPrice;
  5. public double closingPrice;
  6. public void getChangeInPrice(){
  7. double change= closingPrice-openingPrice;
  8. System.out.println("Change is" + change);
  9. }
  10. public void printStockInfo(){
  11. System.out.println("Name: " + name);
  12. System.out.println("Symbol: " + symbol);
  13. System.out.println("Opening Price: " + openingPrice);
  14. System.out.println("Closing Price: "+ closingPrice);
  15. }
  16. }