Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1 Files For this project, you will create an Online Stock Market using what you have learned about classes and objects. This online stock

image text in transcribedimage text in transcribed

Question 1

Files For this project, you will create an "Online Stock Market" using what you have learned about classes and objects. This online stock market should offer stocks for at least three companies. As an example, I created an online stock market that sells Apple, Google and Microsoft stocks. I created three different classes in my project, one for each type of stock, as can be seen in the image below from the NetBeans Project window: Projects x Services Stock MarketProject Source Packages stockmarketproject Apple.java Google.java Microsoft.java Stock MarketProject.java Test Packages Libraries Test Libraries You can use Investopedia to look up stocks To use Investopedia, type in the name of a company in the search box, for example: Austel AAPL APPLE INC APLE APPLE HOSPITALITY REN INC If there is more than one option, choose the company you wish to include in your program from the menu. This will bring you to a page with detailed information about the company's stocks. On the left hand side of the web page you will see the information included in the image below: The price given on the left is the cost of one "share" of MARKETS TODAY the stock. A share is the term used for one unit of a company's stock. In this case, one share of Apple stock costs $174.92 in U.S. dollars. So, if you spent $349.84 on this stock, you would own two shares APPLE INC of Apple stock. The stock symbol for Apple is AAPL" which can be seen in the image above, and the image AAPL NASDAQ to the right. Stock symbols are used to identify companies on the stock market. 174.92 is -4,781-2 Part 1 - The Classes: Create (at least three classes, where each class represents one company's stock. Each class should have the same three fields: A String stock symbol field to store the symbol for the company on the stock market. For example, Apple's stock symbol is AAPL" and Microsoft's stock symbol is MSFT" A double cost field to store the price of one share of the stock An integer field to store the number of shares the user currently owns of that stock Create a no-arg constructor and set the initial number of shares owned to 0, and the cost and stock symbol to the correct values from the Investopedia website. Also, create an argument-based constructor to allow the three fields to be initialized in the main method when the object is created. Create getter and setter methods for each of the three fields. Also, create the following methods: An addShares void method that takes an integer and adds it to the field that currently stores the total number of shares the user owns of that stock A removeShares void method that takes an integer and subtracts it from the field that currently stores the total number of shares the user owns of that stock A calcStockValue method that calculates and returns the total value of all the shares owned of that stock (e.g. if two shares of Apple stock are owned, this method should return 349.84) Include a toString method that prints out a user-friendly message displaying the three fields. Please submit a UML Diagram for one of your three classes when you hand in your project

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

Step: 3

blur-text-image

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

Spomenik Monument Database

Authors: Donald Niebyl, FUEL, Damon Murray, Stephen Sorrell

1st Edition

0995745536, 978-0995745537

More Books

Students also viewed these Databases questions

Question

Differentiate the function. r(z) = 2-8 - 21/2 r'(z) =

Answered: 1 week ago