Question: JAVA Description To begin: Create a new BlueJ project Create a new class in your BlueJ project named StockReport. Add a main()method to StockReport. This
JAVA
Description To begin:
Create a new BlueJ project
Create a new class in your BlueJ project named StockReport.
Add a main()method to StockReport.
This is part of your grade.StockReport Description
The United States has had a stock market since the New York Stock Exchange began in 1792. The early stockbrokers modeled their system on that used in Spain. This was largely due to the fact that the U.S. dollar's value had been based on the value of the Spanish real (meaning "royal", and pronouncedr-l'). The real was the Spanish silver dollar and was divided into eight parts. (This is where the phrase "pieces of eight" comes from.) The real could be broken into two, four or eight parts. When the U.S. stock market began, they based the stock values on one-eighth fractions. Stocks traded at not only eighths, but also sixteenths and thirty-seconds, and sometimes even sixty-fourths. For example, you might have heard something like: IBM is currently trading at 57 5/8 Eighths, of course, do not match neatlywith our decimal number system. In 1997, the Common Cents Stock Pricing Act was signed to simplify the stock market by converting the fractions to decimal. This decimalization of the stock market began in August 2000 and was completed within the following year.
For the purposes of this project, we will pretend that we are working with data in the format of the old system, using eighths. So, given a decimal value, your program will calculate and report the equivalent value broken down into eighths, sixteenths, thirty-seconds and sixty-fourths. For example, a stock price of 32.234375would be equivalent to 32 + 1/8 + 1/16 + 1/32 + 1/64. Here is the algorithm for your program:1.Print an introductory paragraph explaining to the user what the program willaccomplish (see text in exampleson next pagethe first 6 lines).2.UseaScannerto ask the user for the company name ,and save it in a String. Since a company name may contain spaces, you mustusethe nextLine()method to read in the name. For example, assume you have already declared a Scanner named input that is attached to the keyboard. To read a phrase from the keyboard, you write: String phrase = input.nextLine();3.Ask the user fora stock price (per share); this will contain a decimal point.4.Ask the user for a number of shares; you may assume this isan integer.5.Calculate the stock price (per share) in eighths, sixteenths, thirty-seconds,and sixty-fourths.6.Print areport (sample shown below) containing the following information: ocompany name, as read inothe stock priceper share, as read in(in decimal format) othe stock price per share using eighths, sixteenths, thirty-seconds and sixty-fourthsothe total value of the stock (price multiplied by number of shares) this number should be rounded to 2 decimal places
Here are 2 examplesof how your output shouldlook
Welcome to Ye Olde Stock Report!-
This program will report a stock pricein historic format using eighths, as wellas the current value of the holding
Enter a company name: IBMEnter the price of the stock: 220.45
Enter the number of shares held: 22
==========================================Report for IBM------------------------------------------
Current stock quote value: $1542.
'Old' stock quote value: $140 5/8 1/16 1/32 0/64
Total value of stock shares: $4552.25
StockReportHintsReview how the change was calculated in ComputeChange.javaon. The calculations for the fractional part of the stock price will be very similar. In this program, the original number is multiplied by 100, because a penny (0.01 dollar, or 1 cent) is the smallest coin. For this program, your "coins" are 1/8th of a dollar, 1/16thof a dollar, etc. Here are the equivalencies:1/8 = 12.5 cents1/16 = 6.25 cents1/32 = 3.125 cents1/64 = 1.5625 cents
Welcome to Ye Olde Stock Report! This program will report a stock price in historic format using eighths, as well as the current value of the holding. Enter a company name: Microsoft Corporation Enter the price of the stock: 243.79 Enter the number of shares held: 50 Report for Microsoft Corporation Current stock quote value: $243.79 'old' stock quote value: $243 6/8 0/16 1/32 0/64 Total value of stock shares: $12189.5 Welcome to Ye Olde Stock Report! This program will report a stock price in historic format using eighths, as well as the current value of the holding. Enter a company name: IBM Enter the price of the stock: 120.73 Enter the number of shares held: 25 Report for IBM Current stock quote value: $120.73 'old' stock quote value: $120 5/8 1/16 1/32 0/64 Total value of stock shares: $3018.25 Welcome to Ye Olde Stock Report! This program will report a stock price in historic format using eighths, as well as the current value of the holding. Enter a company name: Microsoft Corporation Enter the price of the stock: 243.79 Enter the number of shares held: 50 Report for Microsoft Corporation Current stock quote value: $243.79 'old' stock quote value: $243 6/8 0/16 1/32 0/64 Total value of stock shares: $12189.5 Welcome to Ye Olde Stock Report! This program will report a stock price in historic format using eighths, as well as the current value of the holding. Enter a company name: IBM Enter the price of the stock: 120.73 Enter the number of shares held: 25 Report for IBM Current stock quote value: $120.73 'old' stock quote value: $120 5/8 1/16 1/32 0/64 Total value of stock shares: $3018.25
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
