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 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 the specified symbol and name.   A method named getChangePercent() that returns the percentage changed from previousClosingPrice 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 current price to 34.35. Select 9 more stocks with the current prices and create objects with the current prices as previous Closing prices. After 2 or more days get the price for each stock in your list and use the currentPrice method to store the current prices. Use a for loop to display all the socks Symbols, Name of Stock, Old Price, Current Price and the Price-Change percentage. Use appropriate formatting to show the Currency sign with two decimals. Prompt the user to enter the stock symbol and the number of stocks bought. Compute the profit and display the Stock Symbol, Stock Name, Number of Stock, Total purchase cost, Total selling cost, profit made and profit percentage. Display your name with the text ‘Investment Advisor’. 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 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 the specified symbol and name.   A method named getChangePercent() that returns the percentage changed from previousClosingPrice 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 current price to 34.35. Select 9 more stocks with the current prices and create objects with the current prices as previous Closing prices. After 2 or more days get the price for each stock in your list and use the currentPrice method to store the current prices. Use a for loop to display all the socks Symbols, Name of Stock, Old Price, Current Price and the Price-Change percentage. Use appropriate formatting to show the Currency sign with two decimals. Prompt the user to enter the stock symbol and the number of stocks bought. Compute the profit and display the Stock Symbol, Stock Name, Number of Stock, Total purchase cost, Total selling cost, profit made and profit percentage. Display your name with the text ‘Investment Advisor’.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

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 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 the specified symbol and name.

 

A method named getChangePercent() that returns the percentage changed from previousClosingPrice 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 current price to 34.35. Select 9 more stocks with the current prices and create objects with the current prices as previous Closing prices. After 2 or more days get the price for each stock in your list and use the currentPrice method to store the current prices.

Use a for loop to display all the socks Symbols, Name of Stock, Old Price, Current Price and the Price-Change percentage. Use appropriate formatting to show the Currency sign with two decimals.

Prompt the user to enter the stock symbol and the number of stocks bought. Compute the profit and display the Stock Symbol, Stock Name, Number of Stock, Total purchase cost, Total selling cost, profit made and profit percentage.

Display your name with the text ‘Investment Advisor’.

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 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 the specified symbol and name.

 

A method named getChangePercent() that returns the percentage changed from previousClosingPrice 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 current price to 34.35. Select 9 more stocks with the current prices and create objects with the current prices as previous Closing prices. After 2 or more days get the price for each stock in your list and use the currentPrice method to store the current prices.

Use a for loop to display all the socks Symbols, Name of Stock, Old Price, Current Price and the Price-Change percentage. Use appropriate formatting to show the Currency sign with two decimals.

Prompt the user to enter the stock symbol and the number of stocks bought. Compute the profit and display the Stock Symbol, Stock Name, Number of Stock, Total purchase cost, Total selling cost, profit made and profit percentage.

Display your name with the text ‘Investment Advisor’.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY