340 - Java Programming - R - 2021
340 - Java Programming - R - 2021
Time: ________
Rank: ________
JAVA PROGRAMMING
(340)
REGIONAL – 2021
PRODUCTION PORTION:
GENERAL GUIDELINES:
Failure to adhere to any of the following rules will result in disqualification:
1. Contestant must hand in this test booklet and all printouts if any. Failure to do so will result in
disqualification.
2. No equipment, supplies, or materials other than those specified for this event are allowed in the
testing area. No previous BPA tests and/or sample tests (handwritten, photocopied, or keyed) are
allowed in the testing area.
3. Electronic devices will be monitored according to ACT standards.
4. All work must be saved on the flashdrive provided.
JAVA PROGRAMMING
REGIONAL 2021
Page 3 of 8
Your name and/or school name should not appear on work you submit for scoring.
1. Create a folder on the flash drive provided using your contestant number as the name of the folder.
2. Copy your entire solution/project into this folder.
3. Submit your entire solution/project so that the graders may open your project to review the source
code.
4. Ensure that the files required to run your program are present and will execute on the flash drive
provided.
*Note that the flash drive letter may not be the same when the program is scored as it was when you
created the program.
* It is recommended that you use relative paths rather than absolute paths to ensure that the program
will run regardless of the flash drive letter.
The scorers will not compile or alter your source code to correct for this.
Submissions that do not contain source code will not be graded.
Development Standards:
You are being put in charge of creating a stock trading software that will allow the user to create a simulated
portfolio of stocks. The program will allow the user to determine how many stocks they want to create, enter in a
symbol and a company name, as well as how many shares for the stock. The program will randomly generate a
price for the stock of $1.00 to $200.99.
The program will calculate the value of the stock in the portfolio by finding the product of the price and the
amount of shares (price * shares = value). The program will also print out the entire portfolio to the console with
the following format:
Input:
The program will require three entries via the console: Stock Symbol (String), Stock Name (String), and number
shares (integer). The price will be randomly generated, and the value will be calculated by the price and number
of shared entered. The program will construct a stock object that stores all of the information for the stock, and it
will be stored into a centralized list in the driver class.
Output:
After all stocks are entered by the user, the program will print out all of the stocks stored in the list. The “Price”
and “Total Value” need to be formatted to decimal places and include the symbol “$” in the printed output. All
printed decimal places need to account for zeros being in the hundredths place.
Symbol: [SYMBOL_VARIABLE] | Company Name: [NAME_VARIABLE]| Price:
[PRICE_VARIABLE]| Total Shares: [SHARES_VARIABLE]| Total Value:
[CALCULATED_VALUE]
Sample Run #1 with error in number entry for number of stocks to create
You entered: 1
You will now enter in the company symbol, name and their share quantity. The price will be randomly
generated.
You entered: 1
You will now enter in the company symbol, name and their share quantity. The price will be randomly
generated.
XYZ
XYZ-Company
10
Symbol: XYZ | Company Name: XYZ-Company | Price: $ 174.13 | Total Shares: 10 | Total Value: $
1,741.30
JAVA PROGRAMMING
REGIONAL 2021
Page 6 of 8
You entered: 3
You will now enter in the company symbol, name and their share quantity. The price will be randomly
generated.
Requirements:
1. You must create an application with the main class called StockDriver. This class will host the list to
store the stocks that are created and also control the data entry from the user. There are no third party
files you will need for this program.
2. You will create an object class called Stocks. This class will be instantiated to create the stocks based
upon the user entering data. It will also randomly generate the price and calculate the value of the stock
based upon number of shares and price. Stocks class will print out the information for the stock, format
for two decimal places.
3. Your contestant number must appear as a comment at the top of the main source code file.
4. If incorrect data is entered, then the program should display an appropriate message and exit.
5. The program will perform the required tasks correctly for however many stocks are indicated by the
user.
6. The program will display the output like the example above.
JAVA PROGRAMMING
REGIONAL 2021
Page 8 of 8
REGIONAL – 2021
PRODUCTION PORTION:
Your name and/or school name should not appear on work you submit for scoring.
1. Create a folder on the flash drive provided using your contestant number as the name of the folder.
2. Copy your entire solution/project into this folder.
3. Submit your entire solution/project so that the graders may open your project to review the source code.
4. Ensure that the files required to run your program are present and will execute on the flash drive provided.
*Note that the flash drive letter may not be the same when the program is scored as it was when you created
the program.
* It is recommended that you use relative paths rather than absolute paths to ensure that the program will run
regardless of the flash drive letter.
The scorers will not compile or alter your source code to correct for this.
Submissions that do not contain source code will not be graded.
Development Standards:
Note to Graders:
Output will vary based upon stock symbols, names, and random price generation.
The output format should be very similar.
Error message may differ from sample output.
You entered: 1
You will now enter in the company symbol, name and their share quantity. The price will be
randomly generated.
You entered: 1
You will now enter in the company symbol, name and their share quantity. The price will be
randomly generated.
XYZ
JAVA PROGRAMMING - REGIONAL 2019
REGIONAL KEY 2021
Page 4 of 9
XYZ-Company
10
You entered: 3
You will now enter in the company symbol, name and their share quantity. The price will be
randomly generated.
Suggested Solution
JAVA PROGRAMMING - REGIONAL 2019
REGIONAL KEY 2021
Page 8 of 9
JAVA PROGRAMMING - REGIONAL 2019
REGIONAL KEY 2021
Page 9 of 9