{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lab6 - ● A method named changePercent that returns the...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab 7  Objective:  class definition and object creation UML diagram Write multi-class Java program Lab description In this lab, you are going to 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  previousClosingPrice  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 specified symbol and name. The accessor methods for all data fields. The mutator methods for  previousClosingPrice  and  currentPrice
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: . ● A method named changePercent () that returns the percentage changed from previousClosingPrice to currentPrice . Assume all methods are public and all data fields are private. Draw the UML diagram for the class. Implement the class. Write a test program that creates a Stock object with the stock symbol “SUNW”, the name “Sun Microsystems Inc”, and the previous closing price of 100. Set a new current price to 90 and display the price-change percentage. Submission ● source code including the Stock class and the test program ● UML diagram ● report according to requirements in syllabus...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online