Question: Above: The code I started Below is the unanswered question (code in JAVA) public class StockExercise public static void main(String[] args) { // set current

![in JAVA) public class StockExercise public static void main(String[] args) { //](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f3e05bc2194_71566f3e05b5f76e.jpg)
Above: The code I started
Below is the unanswered question (code in JAVA)
public class StockExercise public static void main(String[] args) { // set current price 1/display stock info System.out.println("Previous Closing Price: ". stock.getPreviousClosingPrice()); System.out.println System.out.println //i have to write code here class Stock { String symbol; String name; double previousClosingPrice; double currentPrice; //cpnstructor public Stock() { } public Stock(String newSymbol, String Newlame) { symbol = newSymbol; name = newname; public double get ChangePercent() { return (currentProce - previousclosingprice) / previousClosingPrice; //cp - PCP / PCP (current price, previous closing price) //pcp public double getPreviousClosingPrice() { return previousClosingPrice // CP public double getCurrentPrice() { return.............; } public void setCurrentPrice(){ } public void stePreviouscclosingPrice() { 9.2 (THE STOCK CLASS) Following the example of the Circle class in Section 9.2, design a class named Stock that contains: A string data field named symbol for the stock's symbol. A string data field named name for the stock's name. A double data field named previous ClosingPrice that stores the stock price for the previous day. A double data field named currentPrice that stores the stock price for the current time. A constructor that creates a stock with the specified symbol and name. A method named getChangePercent() that returns the percentage changed from previous ClosingPrice to currentPrice. Write a test program that creates a Stock object with the stock symbol ORCL, the name Oracle Corporation, and the previous closing price of 34.5. Set a new Set a new current price to 34.35 and display the price-change percentage. ----GRASP exec: java Exercise09_02 Previous Closing Price: 100.0 Current Price: 90.0 Price Change: -10.0% ---GRASP: operation complete
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
