Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A string data field named symbol for the stocks symbol. A string data field named name for the stocks name. A double data field named

  1. A string data field named symbol for the stocks symbol.
  2. A string data field named name for the stocks 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. An integer data field named ID that stores the identifier number of stock.
  6. A constructor that creates a stock with the specified symbol, name, and ID.
  7. A method named getChangePercent() that returns the percentage changed from previousClosingPrice to currentPrice
  8. Create a random object from the Random class (java.util.Random). We will use this object for the ID number of Stock between (0 to 100).
  9. Ask a user for the name and symbol of Stock. So, you should create two string variables in the test program.
  10. Create a Stock object with the stock symbol (from the user), the name of symbol (from the user), and ID (from Random object by using nextInt(100) method).
  11. Ask the user for the previous closing price and the current price. Note: Don't create two variables for them. You can use the Stock object to assign the values of these two variables from the user.
  12. Display the stock name, the stock symbol, the stock ID, and the pricechange percentage.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

1. Explain how technology has changed the learning environment.

Answered: 1 week ago