Kasper123

Stock

Sep 9th, 2025
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. class Stock {
  2.     String symbol;
  3.     String name;
  4.     double previousClosingPrice;
  5.     double currentPrice;
  6.     int ID;
  7.  
  8.     Stock(String s, String n, int i) {
  9.         symbol = s;
  10.         name = n;
  11.         ID = i;
  12.     }
  13.  
  14.     double getChangePercent() {
  15.         return ((currentPrice - previousClosingPrice) / previousClosingPrice) * 100;
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment