Question: Design a class named Stock that contains: 1) a string data field named symbol for the stock's symbol 2) a string data field named name
Design a class named Stock that contains: 1) a string data field named symbol for the stock's symbol 2) a string data field named name for the stock's name 3) a double data field named previousClosingPrice that stores the stock price for the previous day. 4) a double data field named currentPrice that stores the stock price for the current time. 5) a constructor that creates a stock with specified symbol and name 6) the accessor methods for all data fields 7) the mutator methods for previousClosingPrice and currentPrice 8) a method named getChangepercent() that returns the percentage changed from the previousClosingPrice to currentPrice. Draw the UML for the class. Implement the class. Write a test program that 1) creates a Stock object with the stock symbol SUNW, the name Sun Microsystem Inc. 2) Set the previous closing price to 100. 3) Set a new current price to 90. 4) Display the price-change percentage
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
